This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p> | |
<input type="text" name="notes_title" class="col-fluid {{ $errors->first('notes_title', 'error') }}" | |
placeholder="* Whats the title of this note?" | |
value="{{ old('notes_title', (isset($note->notes_title) ? $note->notes_title : '')) }}"> | |
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if($saved = $this->save($request, $gistId)) | |
$request->session()->flash('success', 'Your gist has been saved'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get the element | |
var config = document.getElementById('git-edit'); | |
// get the data-theme='somevalue' | |
var theme = config.dataset.theme; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try { | |
if (is_null($gistId)): | |
$saved = $this->gist->create($request->all()); | |
else : | |
$saved = $this->gist->update($gistId, $request->all()); | |
$this->gist->cacheItem($saved, $gistId); | |
endif; | |
$this->gist->forgetCollection(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if(Session::has('error')) | |
<p class="alert alert-error">{{ Session::get('error') }}</p> | |
@endif | |
@if(Session::has('success')) | |
<p class="alert alert-success">{{ Session::get('success') }}</p> | |
@endif | |
@if(Session::has('warning')) | |
<p class="alert alert-warning">{{ Session::get('warning') }}</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param Request $request | |
* @param null $gistId | |
* @return bool | |
*/ | |
function save(Request $request, $gistId = NULL) | |
{ | |
$this->validate($request, [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(editor.getValue()){ | |
content.value = editor.getValue(); | |
// alert(editor.getValue()); | |
console.log(content.value); | |
document.getElementById('gist-content').submit(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@push('styles') | |
<link rel="stylesheet" href="https://unpkg.com/codemirror@5.23.0/lib/codemirror.css"> | |
@endpush | |
@push('scripts') | |
<script src="https://unpkg.com/codemirror@5.23.0/lib/codemirror.js"></script> | |
@endpush | |
@push('inline_scripts') | |
<script> | |
var editor = document.getElementById('content'); | |
var edit = CodeMirror.fromTextArea(editor, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$key = $this->cacheId . '-' . $gistId; | |
if (Cache::has($key)): | |
$results = Cache::get($key); | |
else : | |
$results = $this->gist->get($gistId); | |
Cache::add($key, $results, 600); | |
endif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? php | |
/** | |
* @param string $url | |
* @return string | |
*/ | |
private function extractIdFromUrl($url) | |
{ | |
$url = rtrim($url, '/'); | |
return last(explode('/', $url)); | |
} |