Skip to content

Commit a49de3e

Browse files
committed
New version for Laravel 5.
1 parent 974cc6e commit a49de3e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+146
-5569
lines changed

.travis.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

LICENSE

Lines changed: 0 additions & 22 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# laravel-writing
22

3-
A writing system for Laravel 4.
3+
A writing system for Laravel 5.
4+
5+
*The following notes are deprecated and are for the Laravel 4 version.*
46

57
## Installation
68

@@ -38,7 +40,7 @@ The following command will copy your assets into `/public/packages/vendor/packag
3840

3941
## License
4042

41-
Thinker is licensed under the MIT license. (http://opensource.org/licenses/MIT)
43+
Writing is licensed under the MIT license. (http://opensource.org/licenses/MIT)
4244

4345
## Me
4446

composer.json

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
{
2-
"name": "nonoesp/writing",
3-
"description": "A writing system for Laravel 4.",
2+
"name": "nono/writing",
3+
"description": "A Laravel blogging system.",
4+
"license": "MIT",
45
"authors": [
56
{
67
"name": "Nono Martínez Alonso",
78
"email": "[email protected]"
89
}
910
],
10-
"require": {
11-
"php": ">=5.4.0",
12-
"illuminate/support": "4.2.*"
13-
},
14-
"autoload": {
15-
"classmap": [
16-
"src/migrations",
17-
"src/controllers",
18-
"src/models"
19-
],
20-
"psr-0": {
21-
"Nonoesp\\Writing\\": "src/"
22-
}
23-
},
24-
"minimum-stability": "stable"
11+
"minimum-stability" : "dev",
12+
"require": {}
2513
}
File renamed without changes.
File renamed without changes.

phpunit.xml

Lines changed: 0 additions & 18 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/views/base.blade.php renamed to resources/views/base.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
$og_description = 'Description of the blog.';
1616
$services_typekit = Config::get('services.typekit.writing');
1717
$header_classes = 'c-header--white';
18+
$is_header_static = true;
1819
1920
// 2. Defaults Cover
20-
$cover_subtitle = Thinker::array_rand_value(Config::get('settings.slogan'));
21+
$cover_subtitle = Thinker::array_rand_value(trans('base.slogan'));
2122
$cover_classes_title_b = '';
2223
$cover_image = '';
2324
$cover_classes = '';
@@ -88,7 +89,7 @@
8889
'subtitle' => $cover_subtitle,
8990
'classes_title_b' => $cover_classes_title_b,
9091
'image' => $cover_image,
91-
'description' => Config::get('settings.description'),
92+
'description' => trans('base.description'),
9293
'class' => 'is-header u-background-grey '.$cover_classes)) }}
9394

9495
@endif
@@ -148,8 +149,7 @@
148149
</script>
149150
@endif
150151

151-
<script type="text/javascript" src="/packages/nonoesp/writing/js/writing.js"></script>
152-
<script type="text/javascript" src="/js/header.js"></script>
152+
<script type="text/javascript" src="/nonoesp/writing/js/writing.js"></script>
153153

154154
@stop
155155

src/views/partial/c-article.blade.php renamed to resources/views/partial/c-article.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
$user_thumbnail = NULL;
2424
$user = NULL;
2525
if($article->user_id) {
26-
$user = User::find($article->user_id);
26+
$user = Arma\User::find($article->user_id);
2727
$user_thumbnail = View::make('partial.c-user-picture')->with(["user" => $user,
2828
"size" => 36]);
2929
}
@@ -36,7 +36,7 @@
3636

3737
{{-- Title --}}
3838
@if (isset($isTitleLinked))
39-
<h1>{{ HTML::link(Config::get('writing::path').'/'.$article->slug, Thinker::title($article->title)) }}</h1>
39+
<h1>{{ HTML::link(Config::get('writing.path').'/'.$article->slug, Thinker::title($article->title)) }}</h1>
4040
@else
4141
<h1>{{ Thinker::title($article->title) }}</h1>
4242
@endif
@@ -92,13 +92,13 @@
9292
@if ($article_type == 'SUMMARY_ARTICLE_TYPE')
9393
<p>
9494
{{ Thinker::limitMarkdownText(Markdown::string($article->text), 275, array('figcaption')) }}
95-
{{ HTML::link(Config::get('writing::path').'/'.$article->slug, trans('writing::base.continue-reading')) }}
95+
{{ HTML::link(Config::get('writing.path').'/'.$article->slug, trans('writing::base.continue-reading')) }}
9696
</p>
9797
@endif
9898

9999
{{-- Tags --}}
100100
@if (count($article->tagNames()) > 0)
101-
<p class="c-article__tags">{{ Writing::displayArticleTags($article->tagNames(), 'c-article__tag u-case-upper') }}</p>
101+
<p class="c-article__tags">{{ Writing::tagListWithArticleAndClass($article, 'c-article__tag u-case-upper') }}</p>
102102
@endif
103103

104104
</div><!--

src/views/profile.blade.php renamed to resources/views/profile.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
@extends('layout.main')
22

3-
43
<?php
4+
use Arma\Article;
55
// Settings
66
$header_classes = 'c-header--relative';
77
88
// User Articles
9-
$articles = \Nonoesp\Writing\Article::where('user_id', '=', $user->id)->orderBy('id', 'DESC')->take(5)->get();
9+
$articles = Article::where('user_id', '=', $user->id)->orderBy('id', 'DESC')->take(5)->get();
1010
1111
$user_thumbnail = \View::make('partial.c-user-picture')->with(["user" => $user,
1212
"size" => 75,

src/Facades/Writing.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
namespace Nonoesp\Writing\Facades;
3+
use Illuminate\Support\Facades\Facade;
4+
class Writing extends Facade {
5+
/**
6+
* Get the registered name of the component.
7+
*
8+
* @return string
9+
*/
10+
protected static function getFacadeAccessor() { return 'writing'; }
11+
12+
}

src/Nonoesp/Writing/Facades/Writing.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/Nonoesp/Writing/WritingServiceProvider.php

Lines changed: 0 additions & 55 deletions
This file was deleted.

src/Nonoesp/Writing/Writing.php renamed to src/Writing.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php namespace Nonoesp\Writing;
2-
2+
use Lang;
3+
34
class Writing {
4-
5+
56
public static function articleCategoryClass($tags, $class) {
67

78
$categories = \Config::get('blog.special-tags'); //TODO: lang in package
@@ -16,18 +17,18 @@ public static function articleCategoryClass($tags, $class) {
1617
return;
1718
}
1819

19-
public static function displayArticleTags($tags, $class) {
20+
public static function tagListWithArticleAndClass($article, $class) {
2021
$result = '';
2122
$idx = 0;
22-
foreach($tags as $tag) {
23-
$result .= Writing::articleTag($tag, $class);
23+
foreach($article->tags as $tag) {
24+
$result .= Writing::tagWithClass($tag, $class);
2425
$idx++;
2526
}
2627
return $result;
2728
}
2829

29-
public static function articleTag($tag, $class) {
30-
return \HTML::link(\Config::get('writing::path').'/tag/'.\Conner\Tagging\TaggingUtil::slug($tag), $tag, array('class' => $class));
30+
public static function tagWithClass($tag, $class) {
31+
return \HTML::link(\Config::get('writing.path').'/tag/'.$tag->slug, $tag->name, array('class' => $class));
3132
}
3233

3334
public static function userURL($user) {

src/controllers/WritingController.php renamed to src/WritingController.php

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
1-
<?php namespace Nonoesp\Writing;
2-
3-
//use Nonoesp\Writing\Article;
4-
use Article;
5-
6-
class WritingController extends \BaseController {
7-
8-
/*
9-
|--------------------------------------------------------------------------
10-
| Default Home Controller
11-
|--------------------------------------------------------------------------
12-
|
13-
| You may wish to use controllers instead of, or in addition to, Closure
14-
| based routes. That's great! Here is an example controller method to
15-
| get you started. To route to this controller, just add the route:
16-
|
17-
| Route::get('/', 'HomeController@showWelcome');
18-
|
19-
*/
1+
<?php
202

3+
namespace Nonoesp\Writing;
4+
5+
use Illuminate\Http\Request;
6+
use Arma\Http\Requests;
7+
use Arma\Http\Controllers\Controller;
8+
use View;
9+
use Arma\Article;
10+
use Arma\User;
11+
12+
class WritingController extends Controller
13+
{
2114
public function showHome() {
2215

2316
// Get Articles + Articles ids
@@ -34,7 +27,7 @@ public function showHome() {
3427
// Get Expected Articles
3528
$show_expected = 3;
3629
$articles_expected = Article::expected()->orderBy('published_at', 'ASC')->take($show_expected)->get()->reverse();
37-
return \View::make('writing::base')->with(array('articles' => $articles,
30+
return view('writing::base')->with(array('articles' => $articles,
3831
'ids' => $ids_array,
3932
'articles_expected' => $articles_expected));
4033
}
@@ -55,7 +48,7 @@ public function showArticleTag($tag) {
5548
}
5649
}
5750

58-
return \View::make('writing::base')->
51+
return view('writing::base')->
5952
with(array(
6053
'articles' => $articles,
6154
'ids' => $ids_array,
@@ -67,7 +60,7 @@ public function showArticle($slug) {
6760
$article = Article::whereSlug($slug)->first();
6861
$article->visits++;
6962
$article->save();
70-
return \View::make('writing::base')->with('article', $article);
63+
return view('writing::base')->with('article', $article);
7164
}
7265

7366
public function showArticleWithId($id) {
@@ -82,7 +75,7 @@ public function getArticlesWithIds() {
8275

8376
// Echo Articles
8477
foreach(\Input::get('ids') as $id) {
85-
echo \View::make('partial.blog.c-article')->
78+
echo view('partial.blog.c-article')->
8679
with(array('article' => Article::find($id),
8780
'article_type' => $article_type,
8881
'isTitleLinked' => true));

0 commit comments

Comments
 (0)