-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from ivinteractive/dev
Add widget and register blueprint; Assets workflow update; Fixed undefined variable errors
- Loading branch information
Showing
12 changed files
with
2,539 additions
and
36 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php if(!defined('KIRBY')) exit ?> | ||
|
||
title: Redirects | ||
pages: false | ||
options: | ||
preview: false | ||
delete: false | ||
template: false | ||
status: false | ||
deletable: false | ||
hide: true | ||
files: | ||
type: | ||
- code | ||
- document | ||
fields: | ||
title: | ||
label: Title | ||
type: text | ||
redirects: | ||
label: Redirects | ||
type: structure | ||
style: table | ||
fields: | ||
old: | ||
label: Old URL | ||
type: text | ||
icon: times | ||
new: | ||
label: New URL | ||
type: text | ||
icon: check | ||
external: | ||
label: External | ||
text: Is it an external link? | ||
type: checkbox | ||
icon: share |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
var gulp = require('gulp'), | ||
sass = require('gulp-sass'), | ||
csso = require('gulp-csso'), | ||
autoprefixer = require('gulp-autoprefixer'), | ||
shorthand = require('gulp-shorthand'), | ||
notify = require('gulp-notify'), | ||
plumber = require('gulp-plumber'), | ||
watch = require('gulp-watch'), | ||
runSequence = require('run-sequence'); | ||
|
||
var paths = { | ||
scss: './resources/scss', | ||
css: './assets/css' | ||
}; | ||
|
||
gulp.task('view', function() { | ||
|
||
gulp.src(paths.scss + '/redirecty.scss') | ||
.pipe(plumber({errorHandler: notify.onError("SASS error: <%= error.message %> in <%= error.filename %>")})) | ||
.pipe(sass({ | ||
outputStyle: 'expanded', | ||
})) | ||
.pipe(csso()) | ||
.pipe(autoprefixer({ | ||
browsers: ['> 1%'], | ||
cascade: false | ||
})) | ||
.pipe(gulp.dest(paths.css)); | ||
|
||
}); | ||
|
||
gulp.task('widget', function() { | ||
|
||
gulp.src(paths.scss + '/widget.scss') | ||
.pipe(plumber({errorHandler: notify.onError("SASS error: <%= error.message %> in <%= error.filename %>")})) | ||
.pipe(sass({ | ||
outputStyle: 'expanded', | ||
})) | ||
.pipe(csso()) | ||
.pipe(autoprefixer({ | ||
browsers: ['> 1%'], | ||
cascade: false | ||
})) | ||
.pipe(gulp.dest(paths.css)); | ||
|
||
}); | ||
|
||
gulp.task('sass', function() { | ||
runSequence('view', 'widget'); | ||
}); | ||
|
||
gulp.task('default', function() { | ||
gulp.watch(paths.scss + '/*.scss', ['view', 'widget']); | ||
}); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "redirecty", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"repository": "https://github.com/ivinteractive/kirbycms-redirects.git", | ||
"author": "iv-craig <cs@ivinteractive.com>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"gulp": "^3.9.1", | ||
"gulp-autoprefixer": "^3.1.1", | ||
"gulp-csso": "^3.0.0", | ||
"gulp-notify": "^3.0.0", | ||
"gulp-plumber": "^1.1.0", | ||
"gulp-sass": "^3.1.0", | ||
"gulp-shorthand": "^1.1.0", | ||
"gulp-watch": "^4.3.11", | ||
"run-sequence": "^1.2.2" | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
body { | ||
font-family: "Source Sans Pro", sans-serif; | ||
max-width: 1150px; | ||
margin: 0 auto; | ||
position: relative; | ||
} | ||
a { | ||
text-decoration: none !important; | ||
} | ||
h1 { | ||
margin: 20px 0 5px; | ||
} | ||
h2 { | ||
margin: 0 0 25px; | ||
} | ||
h1, h2, h3 { | ||
font-weight: normal; | ||
} | ||
.error { | ||
font-size: 3em; | ||
margin: 1em auto 0.5em; | ||
display: block; | ||
width: 0; | ||
} | ||
|
||
download { | ||
position: absolute; | ||
right: 0; | ||
bottom: 0; | ||
body { | ||
font-family: "Source Sans Pro", sans-serif; | ||
max-width: 1150px; | ||
margin: 0 auto; | ||
position: relative; | ||
} | ||
a { | ||
text-decoration: none !important; | ||
} | ||
h1 { | ||
margin: 20px 0 5px; | ||
} | ||
h2 { | ||
margin: 0 0 25px; | ||
} | ||
h1, h2, h3 { | ||
font-weight: normal; | ||
} | ||
.error { | ||
font-size: 3em; | ||
margin: 1em auto 0.5em; | ||
display: block; | ||
width: 0; | ||
} | ||
|
||
download { | ||
position: absolute; | ||
right: 0; | ||
bottom: 0; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#redirecty-widget { | ||
td { | ||
padding: 0.5em; | ||
span { | ||
display: block; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
} | ||
} | ||
p { | ||
margin: 0.75em 0 0.75em; | ||
} | ||
.btn { | ||
margin-right: 0.75em; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
$options = [ | ||
[ | ||
'text' => 'View all', | ||
'icon' => 'pencil', | ||
'link' => '/panel/pages/'.c::get('redirects-list-uri', 'redirects').'/edit' | ||
] | ||
]; | ||
|
||
if(c::get('redirecty')) | ||
$options[] = [ | ||
'text' => 'Link replacer', | ||
'icon' => 'copy', | ||
'link' => url(c::get('redirecty-uri', 'redirecty')), | ||
'target' => '_blank' | ||
]; | ||
|
||
return array( | ||
'title' => 'Redirecty', | ||
'options' => $options, | ||
'html' => function() { | ||
|
||
$limit = c::get('redirecty-widget-count', 5); | ||
|
||
$redirects = page(c::get('redirects-list-uri', 'redirects'))->redirects()->toStructure()->flip(); | ||
|
||
$count = $redirects->count() - $limit; | ||
$redirects = $redirects->limit($limit); | ||
|
||
$content = brick('style', file_get_contents(__DIR__ . DS . '..' . DS . '..' . DS . 'assets' . DS . 'css' . DS . 'widget.css')); | ||
|
||
if($redirects->count()): | ||
$content.= brick('p', 'Recently added redirects'.r($count, ' <em>('.$count.' more...)</em>', '')); | ||
$content.= '<table class="structure-table"><thead><tr><th>Old</th><th>New</th></tr></thead>'; | ||
$content.= '<tbody>'; | ||
|
||
foreach($redirects as $redirect) | ||
$content.= '<tr><td><span>'.$redirect->old()->value().'</span></td><td><span>'.$redirect->new()->value().'</span></td></tr>'; | ||
|
||
$content.= '</tbody></table>'; | ||
endif; | ||
|
||
if(c::get('redirecty') && $redirects->count()) | ||
$content.= brick('p', brick('a', 'Download CSV', ['href'=>url(c::get('redirecty-csv','redirecty-csv')), 'class'=>'btn btn-rounded']) . brick('a', 'Download JSON', ['href'=>url(c::get('redirecty-json','redirecty-json')), 'class'=>'btn btn-rounded'])); | ||
|
||
return brick('div', $content, ['class'=>'redirecty-widget']); | ||
|
||
} | ||
); |
Oops, something went wrong.