storytime 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/Gemfile.lock +238 -185
- data/README.md +21 -21
- data/app/assets/javascripts/storytime/application.js +5 -3
- data/app/assets/javascripts/storytime/base.js.coffee +5 -4
- data/app/assets/javascripts/storytime/media.js.coffee +7 -2
- data/app/assets/javascripts/storytime/{users.js.coffee → memberships.js.coffee} +3 -4
- data/app/assets/javascripts/storytime/navigations.js.coffee +7 -0
- data/app/assets/javascripts/storytime/wysiwyg.js.coffee +23 -11
- data/app/assets/stylesheets/storytime/application.scss +2 -1
- data/app/assets/stylesheets/storytime/dashboard_overrides.scss +4 -0
- data/app/assets/stylesheets/storytime/media.scss +2 -0
- data/app/assets/stylesheets/storytime/navigation.scss +7 -0
- data/app/assets/stylesheets/storytime/posts.scss +70 -61
- data/app/controllers/storytime/application_controller.rb +8 -7
- data/app/controllers/storytime/blogs_controller.rb +10 -5
- data/app/controllers/storytime/dashboard/blogs_controller.rb +0 -1
- data/app/controllers/storytime/dashboard/custom_posts_controller.rb +1 -1
- data/app/controllers/storytime/dashboard/links_controller.rb +16 -0
- data/app/controllers/storytime/dashboard/memberships_controller.rb +56 -6
- data/app/controllers/storytime/dashboard/navigations_controller.rb +66 -0
- data/app/controllers/storytime/dashboard/pages_controller.rb +7 -3
- data/app/controllers/storytime/dashboard/posts_controller.rb +7 -5
- data/app/controllers/storytime/dashboard/sites_controller.rb +1 -1
- data/app/controllers/storytime/dashboard_controller.rb +3 -3
- data/app/controllers/storytime/pages_controller.rb +3 -3
- data/app/helpers/storytime/application_helper.rb +9 -1
- data/app/models/concerns/storytime/scoped_to_site.rb +5 -3
- data/app/models/storytime/blog.rb +0 -1
- data/app/models/storytime/link.rb +22 -0
- data/app/models/storytime/membership.rb +2 -0
- data/app/models/storytime/navigation.rb +19 -0
- data/app/models/storytime/post.rb +8 -4
- data/app/models/storytime/site.rb +3 -2
- data/app/policies/storytime/membership_policy.rb +13 -1
- data/app/policies/storytime/snippet_policy.rb +5 -1
- data/app/views/layouts/storytime/dashboard.html.erb +2 -1
- data/app/views/storytime/application/storytime/_header.html.erb +1 -0
- data/app/views/storytime/blogs/_tags.html.erb +1 -1
- data/app/views/storytime/blogs/show.html.erb +1 -1
- data/app/views/storytime/dashboard/_navigation.html.erb +12 -8
- data/app/views/storytime/dashboard/_settings_tabs.html.erb +1 -1
- data/app/views/storytime/dashboard/blog_posts/edit.html.erb +1 -1
- data/app/views/storytime/dashboard/blog_posts/new.html.erb +1 -1
- data/app/views/storytime/dashboard/blogs/_blog.html.erb +1 -1
- data/app/views/storytime/dashboard/media/_gallery.html.erb +12 -11
- data/app/views/storytime/dashboard/{users → memberships}/_edit.html.erb +6 -7
- data/app/views/storytime/dashboard/memberships/_index.html.erb +1 -1
- data/app/views/storytime/dashboard/memberships/_membership.html.erb +1 -1
- data/app/views/storytime/dashboard/{users → memberships}/_new.html.erb +3 -3
- data/app/views/storytime/dashboard/memberships/edit.json.jbuilder +2 -0
- data/app/views/storytime/dashboard/memberships/new.json.jbuilder +2 -0
- data/app/views/storytime/dashboard/memberships/save.json.jbuilder +1 -1
- data/app/views/storytime/dashboard/navigations/_blog_link_fields.html.erb +8 -0
- data/app/views/storytime/dashboard/navigations/_external_link_fields.html.erb +7 -0
- data/app/views/storytime/dashboard/navigations/_form.html.erb +58 -0
- data/app/views/storytime/dashboard/navigations/_navigation.html.erb +25 -0
- data/app/views/storytime/dashboard/navigations/_page_link_fields.html.erb +8 -0
- data/app/views/storytime/dashboard/navigations/edit.html.erb +1 -0
- data/app/views/storytime/dashboard/navigations/index.html.erb +15 -0
- data/app/views/storytime/dashboard/navigations/new.html.erb +1 -0
- data/app/views/storytime/dashboard/pages/edit.html.erb +1 -1
- data/app/views/storytime/dashboard/pages/new.html.erb +1 -1
- data/app/views/storytime/dashboard/posts/_image_toolbar.html.erb +4 -1
- data/app/views/storytime/dashboard/posts/_list.html.erb +10 -8
- data/app/views/storytime/dashboard/posts/edit.html.erb +1 -1
- data/app/views/storytime/dashboard/posts/index.html.erb +16 -5
- data/app/views/storytime/dashboard/posts/new.html.erb +1 -1
- data/app/views/storytime/navigations/_navigation.html.erb +3 -0
- data/app/views/storytime/posts/_post.html.erb +1 -1
- data/app/views/storytime/posts/_tags.html.erb +1 -1
- data/app/views/storytime/sites/_google_analytics_code.html.erb +4 -3
- data/app/views/storytime/snippets/_snippet.html.erb +1 -1
- data/config/initializers/assets.rb +1 -1
- data/config/initializers/storytime_admin.rb +2 -0
- data/config/initializers/url_for_patch.rb +6 -6
- data/config/locales/en.yml +18 -0
- data/config/routes.rb +11 -10
- data/db/migrate/20141021073356_create_storytime_snippets.rb +1 -1
- data/db/migrate/20150520181115_create_storytime_navigations.rb +12 -0
- data/db/migrate/20150520185227_create_storytime_links.rb +11 -0
- data/db/migrate/20150520190700_add_position_to_storytime_links.rb +6 -0
- data/db/migrate/20150529192058_add_url_to_storytime_links.rb +5 -0
- data/lib/generators/storytime/views_generator.rb +2 -3
- data/lib/generators/templates/storytime.rb +22 -15
- data/lib/storytime/concerns/current_site.rb +1 -1
- data/lib/storytime/concerns/has_versions.rb +8 -8
- data/lib/storytime/constraints/page_constraint.rb +2 -2
- data/lib/storytime/engine.rb +2 -0
- data/lib/storytime/storytime_helpers.rb +7 -5
- data/lib/storytime/version.rb +1 -1
- data/lib/storytime.rb +29 -11
- data/spec/controllers/dashboard_controller_spec.rb +4 -4
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/dummy/db/schema.rb +61 -35
- data/spec/factories/navigation_factories.rb +6 -0
- data/spec/features/blogs_spec.rb +2 -2
- data/spec/features/comments_spec.rb +4 -4
- data/spec/features/dashboard/media_spec.rb +7 -7
- data/spec/features/dashboard/memberships_spec.rb +62 -4
- data/spec/features/dashboard/navigations_spec.rb +33 -0
- data/spec/features/dashboard/pages_spec.rb +26 -16
- data/spec/features/dashboard/posts_spec.rb +65 -15
- data/spec/features/dashboard/sites_spec.rb +5 -5
- data/spec/features/dashboard/snippets_spec.rb +5 -5
- data/spec/features/dashboard/subscription_spec.rb +5 -5
- data/spec/features/pages_spec.rb +3 -3
- data/spec/features/posts_spec.rb +1 -1
- data/spec/features/subscription_spec.rb +2 -2
- data/spec/lib/storytime_helpers_spec.rb +37 -0
- data/spec/models/navigation_spec.rb +21 -0
- data/spec/requests/routings_spec.rb +8 -8
- data/spec/spec_helper.rb +5 -5
- data/spec/support/feature_macros.rb +1 -1
- data/storytime.gemspec +6 -4
- metadata +69 -23
- data/app/views/storytime/dashboard/users/edit.json.jbuilder +0 -2
- data/app/views/storytime/dashboard/users/new.json.jbuilder +0 -2
- data/screenshots/admin.png +0 -0
- data/screenshots/media.png +0 -0
- data/screenshots/page-list.png +0 -0
- data/screenshots/post-editor.png +0 -0
- data/screenshots/site-settings.png +0 -0
- data/screenshots/text-snippets.png +0 -0
- data/screenshots/user-management.png +0 -0
- data/spec/features/dashboard/users_spec.rb +0 -66
data/README.md
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
![Storytime](https://flyoverworks-com.s3.amazonaws.com/uploads/storytime/media/file/125/final-st-logo-02_thumb.png)
|
2
2
|
|
3
|
-
[![Circle CI](https://circleci.com/gh/
|
3
|
+
[![Circle CI](https://circleci.com/gh/CultivateLabs/storytime/tree/master.svg?style=svg)](https://circleci.com/gh/CultivateLabs/storytime/tree/master)
|
4
4
|
|
5
|
-
Storytime is a Rails 4+ CMS and blogging engine, with a core focus on content. It is built and maintained by [
|
5
|
+
Storytime is a Rails 4+ CMS and blogging engine, with a core focus on content. It is built and maintained by [CultivateLabs](https://www.cultivatelabs.com/?utm_source=github&utm_medium=readme&utm_campaign=github) / [@cultivatelabs](http://twitter.com/cultivatelabs)
|
6
6
|
|
7
7
|
## Features
|
8
8
|
|
9
|
-
* [Simple integration with Rails 4+ apps](https://github.com/
|
10
|
-
* [Quick access dashboard](https://github.com/
|
11
|
-
* [Multi-site support](https://github.com/
|
12
|
-
* [Inline text snippet editing](https://github.com/
|
13
|
-
* [Admin of other Rails models](https://github.com/
|
14
|
-
* [Custom Post Types](https://github.com/
|
15
|
-
* [Email list building](https://github.com/
|
16
|
-
* [New post notifications](https://github.com/
|
17
|
-
* [Built-in search](https://github.com/
|
9
|
+
* [Simple integration with Rails 4+ apps](https://github.com/CultivateLabs/storytime/wiki/Setup) - Quickly get set up using a guided, automated, or manual setup experience, whatever suits your fancy.
|
10
|
+
* [Quick access dashboard](https://github.com/CultivateLabs/storytime/wiki/Using-the-Quick-Access-Menu) - Access Storytime's dashboard from anywhere on your site with our quick access menu.
|
11
|
+
* [Multi-site support](https://github.com/CultivateLabs/storytime/wiki/Multi-site-Support) - Manage multiple sites with one Storytime deployment.
|
12
|
+
* [Inline text snippet editing](https://github.com/CultivateLabs/storytime/wiki/Text-Snippets) - Create and edit snippets of content that can be re-used throughout your Storytime site.
|
13
|
+
* [Admin of other Rails models](https://github.com/CultivateLabs/storytime/wiki/Admin-of-Rails-Models) - Manage your models from the Storytime dashboard.
|
14
|
+
* [Custom Post Types](https://github.com/CultivateLabs/storytime/wiki/Using-Custom-Post-Types) - Add custom post types to alter functionality or appearance of posts.
|
15
|
+
* [Email list building](https://github.com/CultivateLabs/storytime/wiki/Email-Subscriptions) - Collect and manage emails using a simple view helper.
|
16
|
+
* [New post notifications](https://github.com/CultivateLabs/storytime/wiki/Working-with-New-Post-Notifications) - Send notifications to your site's subscribers whenever you publish a post.
|
17
|
+
* [Built-in search](https://github.com/CultivateLabs/storytime/wiki/Using-Storytime%27s-Post-Search) - Easily search through Storytime's posts using built-in search adapters or request parameters.
|
18
18
|
|
19
19
|
## Separation of Concerns
|
20
20
|
|
@@ -39,7 +39,7 @@ This separation is intended to provide several benefits and/or solve several pro
|
|
39
39
|
|
40
40
|
## Sample App
|
41
41
|
|
42
|
-
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/
|
42
|
+
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/CultivateLabs/storytime-example/blob/master)
|
43
43
|
|
44
44
|
## Installation
|
45
45
|
|
@@ -131,30 +131,30 @@ $ rails generate storytime:views
|
|
131
131
|
|
132
132
|
## Getting Started
|
133
133
|
|
134
|
-
See the [Storytime Wiki](https://github.com/
|
134
|
+
See the [Storytime Wiki](https://github.com/CultivateLabs/storytime/wiki) for more documentation and information on using Storytime's various features.
|
135
135
|
|
136
136
|
## Screen Shots
|
137
137
|
|
138
138
|
Page List:
|
139
|
-
![Page List](https://raw.githubusercontent.com/
|
139
|
+
![Page List](https://raw.githubusercontent.com/CultivateLabs/storytime/master/screenshots/page-list.png "Page List")
|
140
140
|
|
141
141
|
Post Editor:
|
142
|
-
![Post Editor](https://raw.githubusercontent.com/
|
142
|
+
![Post Editor](https://raw.githubusercontent.com/CultivateLabs/storytime/master/screenshots/post-editor.png "Post Editor")
|
143
143
|
|
144
144
|
Admin of Custom Rails Models:
|
145
|
-
![Admin of Custom Rails Models](https://raw.githubusercontent.com/
|
145
|
+
![Admin of Custom Rails Models](https://raw.githubusercontent.com/CultivateLabs/storytime/master/screenshots/admin.png "Admin of Custom Rails Models")
|
146
146
|
|
147
147
|
Text Snippets:
|
148
|
-
![Text Snippets](https://raw.githubusercontent.com/
|
148
|
+
![Text Snippets](https://raw.githubusercontent.com/CultivateLabs/storytime/master/screenshots/text-snippets.png "Text Snippets")
|
149
149
|
|
150
150
|
User Management:
|
151
|
-
![User Management](https://raw.githubusercontent.com/
|
151
|
+
![User Management](https://raw.githubusercontent.com/CultivateLabs/storytime/master/screenshots/user-management.png "User Management")
|
152
152
|
|
153
153
|
Site Settings:
|
154
|
-
![Site Settings](https://raw.githubusercontent.com/
|
154
|
+
![Site Settings](https://raw.githubusercontent.com/CultivateLabs/storytime/master/screenshots/site-settings.png "Site Settings")
|
155
155
|
|
156
156
|
Media Uploads:
|
157
|
-
![Media Uploads](https://raw.githubusercontent.com/
|
157
|
+
![Media Uploads](https://raw.githubusercontent.com/CultivateLabs/storytime/master/screenshots/media.png "Media Uploads")
|
158
158
|
|
159
159
|
## Copyright
|
160
|
-
Copyright © 2014-2015
|
160
|
+
Copyright © 2014-2015 CultivateLabs Inc. Storytime is released under the [MIT-LICENSE](MIT-LICENSE).
|
@@ -13,13 +13,15 @@
|
|
13
13
|
//= require_self
|
14
14
|
//= require jquery
|
15
15
|
//= require jquery_ujs
|
16
|
-
//= require bootstrap
|
16
|
+
//= require bootstrap-sprockets
|
17
17
|
//= require leather
|
18
|
+
//= require cocoon
|
18
19
|
//= require jquery-ui/core
|
19
20
|
//= require jquery-ui/datepicker
|
20
21
|
//= require jquery-ui/position
|
21
22
|
//= require jquery-ui/widget
|
22
23
|
//= require jquery-ui/resizable
|
24
|
+
//= require jquery-ui/sortable
|
23
25
|
//= require jquery.ui.timepicker
|
24
26
|
//= require jquery.iframe-transport.js
|
25
27
|
//= require jquery.fileupload.js
|
@@ -30,10 +32,10 @@
|
|
30
32
|
//= require codemirror/addons/fold/xml-fold
|
31
33
|
//= require codemirror/addons/edit/closetag
|
32
34
|
//= require codemirror/addons/edit/closebrackets
|
33
|
-
//= require tidy
|
34
35
|
//= require chosen.jquery
|
35
36
|
//= require medium-editor.min
|
37
|
+
//= require storytime_admin
|
36
38
|
//= require_tree .
|
37
39
|
|
38
40
|
window.Storytime || (window.Storytime = {})
|
39
|
-
window.Storytime.Dashboard = {}
|
41
|
+
window.Storytime.Dashboard = {}
|
@@ -9,7 +9,7 @@ initJS = (controller, action) ->
|
|
9
9
|
$ ()->
|
10
10
|
initJS($("body").data("controller"), $("body").data("action"))
|
11
11
|
|
12
|
-
$(".flash").delay(4000).fadeOut() unless window.Storytime.test_env
|
12
|
+
$(".flash").delay(4000).fadeOut() unless window.Storytime.test_env || window.Storytime.persistent_flash_message
|
13
13
|
|
14
14
|
$(".chosen").chosen()
|
15
15
|
|
@@ -22,9 +22,10 @@ $ ()->
|
|
22
22
|
alert("There was an error deleting your #{$(@).data('resource-type')}")
|
23
23
|
)
|
24
24
|
|
25
|
-
$(".table-row-link").click ->
|
26
|
-
|
27
|
-
|
25
|
+
$(".table-row-link").on "click", (e) ->
|
26
|
+
unless $(e.target).data("confirm")? || $(e.target).parent("a[data-confirm]").length > 0
|
27
|
+
url = $(@).data('url')
|
28
|
+
document.location.href = url
|
28
29
|
|
29
30
|
$(document).on "click", ".storytime-menu-toggle", (e) ->
|
30
31
|
e.preventDefault()
|
@@ -62,12 +62,17 @@ class Storytime.Dashboard.Media
|
|
62
62
|
$("#insertMediaModal").modal("hide")
|
63
63
|
return
|
64
64
|
else
|
65
|
-
image_tag = "
|
65
|
+
image_tag = "
|
66
|
+
<div class='storytime-image text-center'>
|
67
|
+
<img src='#{$(@).data("image-url")}' />
|
68
|
+
<div class='storytime-image-caption text-center' style='margin-left:auto; margin-right: auto;'></div>
|
69
|
+
</div>
|
70
|
+
"
|
66
71
|
if self.elementContainsSelection($("#medium-editor-post")[0])
|
67
72
|
self.pasteHtmlAtCaret(image_tag, false)
|
68
73
|
else
|
69
74
|
$("#medium-editor-post").append(image_tag)
|
70
|
-
|
75
|
+
|
71
76
|
input = $($("#medium-editor-post").data("input"))
|
72
77
|
html = $("#medium-editor-post").html()
|
73
78
|
input.val(html)
|
@@ -1,10 +1,9 @@
|
|
1
|
-
class Storytime.Dashboard.
|
1
|
+
class Storytime.Dashboard.Memberships
|
2
2
|
initIndex: () ->
|
3
3
|
$(".chosen").chosen
|
4
|
-
width:
|
4
|
+
width: "100%"
|
5
5
|
|
6
6
|
$(document).on "ajax:success", ".new_membership", (e, data, status, xhr) ->
|
7
|
-
console.log data.html
|
8
7
|
$("#storytime-modal .modal-content").html(data.html)
|
9
8
|
$(".chosen").chosen
|
10
|
-
width:
|
9
|
+
width: "100%"
|
@@ -3,6 +3,7 @@ class Storytime.Dashboard.Wysiwyg
|
|
3
3
|
buttons: ['bold', 'italic', 'underline', 'anchor', 'header1', 'header2', 'quote', 'unorderedlist', 'orderedlist', 'pre']
|
4
4
|
toolbarAlign: 'center'
|
5
5
|
buttonLabels: 'fontawesome'
|
6
|
+
checkLinkFormat: true
|
6
7
|
|
7
8
|
codeMirrorOptions =
|
8
9
|
mode: 'htmlmixed'
|
@@ -52,6 +53,12 @@ class Storytime.Dashboard.Wysiwyg
|
|
52
53
|
self.closeImageControls()
|
53
54
|
mediumEditor.activate()
|
54
55
|
|
56
|
+
$('body').on "keyup", "#medium-image-caption", () ->
|
57
|
+
caption = $(".medium-active-image").parent(".storytime-image").find(".storytime-image-caption")
|
58
|
+
caption.css("width", $(".medium-active-image").width())
|
59
|
+
caption.text($(this).val())
|
60
|
+
|
61
|
+
|
55
62
|
$("body").on 'click', '.medium-editor img', (e) ->
|
56
63
|
active = $(this).hasClass("medium-active-image")
|
57
64
|
unless active
|
@@ -59,19 +66,24 @@ class Storytime.Dashboard.Wysiwyg
|
|
59
66
|
$(this).addClass "medium-active-image"
|
60
67
|
$("#medium-image-width").val($(this)[0].style.width)
|
61
68
|
$("#medium-image-height").val($(this)[0].style.height)
|
69
|
+
$("#medium-image-caption").val($(this).parent(".storytime-image").find(".storytime-image-caption").text())
|
62
70
|
$("#medium-image-button").hide()
|
63
71
|
$(".medium-image-controls").show()
|
64
72
|
mediumEditor.deactivate()
|
65
73
|
|
66
74
|
$('body').on "keyup", "#medium-image-width", () ->
|
75
|
+
$img = $(".medium-active-image")
|
67
76
|
if $(this).val() == "" || $(this).val() == "auto"
|
68
|
-
$
|
77
|
+
$img.css("width", "")
|
69
78
|
$("#medium-image-height").val("")
|
70
79
|
$("#medium-image-width").val("")
|
71
80
|
else
|
72
|
-
$
|
73
|
-
$
|
74
|
-
$("#medium-image-height").val($
|
81
|
+
$img.css("width", $(this).val())
|
82
|
+
$img.css("height", "")
|
83
|
+
$("#medium-image-height").val($img.css("height"))
|
84
|
+
|
85
|
+
$caption = $img.parent(".storytime-image").find(".storytime-image-caption")
|
86
|
+
$caption.css("width", $img.css("width"))
|
75
87
|
|
76
88
|
$('body').on "keyup", "#medium-image-height", () ->
|
77
89
|
# set the height, then find the new width and set that and remove the height so image remains responsive
|
@@ -84,21 +96,20 @@ class Storytime.Dashboard.Wysiwyg
|
|
84
96
|
|
85
97
|
$('body').on "click", ".medium-image-float", () ->
|
86
98
|
direction = $(this).data("float")
|
87
|
-
|
99
|
+
container = $(".medium-active-image").parent(".storytime-image")
|
88
100
|
switch direction
|
89
|
-
when "left" then
|
90
|
-
when "right" then
|
91
|
-
when "none" then
|
101
|
+
when "left" then container.removeClass("pull-right pull-left").addClass("pull-left")
|
102
|
+
when "right" then container.removeClass("pull-right pull-left").addClass("pull-right")
|
103
|
+
when "none" then container.removeClass("pull-right pull-left").addClass("text-center")
|
92
104
|
|
93
105
|
$('body').on "click", ".medium-image-delete", () ->
|
94
|
-
image = $(".medium-active-image")
|
106
|
+
image = $(".medium-active-image").parent(".storytime-image")
|
95
107
|
image.remove()
|
96
108
|
self.updateFromMediumEditor()
|
97
109
|
self.closeImageControls()
|
98
110
|
mediumEditor.activate()
|
99
111
|
|
100
112
|
openImageControls: (image) ->
|
101
|
-
console.log image
|
102
113
|
image.addClass("medium-active-image")
|
103
114
|
$("#medium-image-width").val(image[0].style.width)
|
104
115
|
$("#medium-image-height").val(image[0].style.height)
|
@@ -153,7 +164,8 @@ class Storytime.Dashboard.Wysiwyg
|
|
153
164
|
editor.toggle()
|
154
165
|
code.toggle()
|
155
166
|
|
156
|
-
html =
|
167
|
+
html = wysiwyg.find('.medium-editor').html()
|
168
|
+
html = tidy_html5 html, tidyOptions unless window.Storytime.test_env
|
157
169
|
codemirror.setValue(html)
|
158
170
|
|
159
171
|
codemirror.refresh()
|
@@ -1,4 +1,4 @@
|
|
1
|
-
@import url(
|
1
|
+
@import url("//fonts.googleapis.com/css?family=Merriweather:400,300,700,900|Open+Sans:400,300,600");
|
2
2
|
@import "storytime/icons";
|
3
3
|
|
4
4
|
$st-brand-primary: #4B71C3;
|
@@ -68,6 +68,7 @@ $st-headings-font-weight: 700;
|
|
68
68
|
@import "storytime/versions";
|
69
69
|
@import "storytime/navigation";
|
70
70
|
@import "storytime/scroll-panels";
|
71
|
+
@import "storytime/dashboard_overrides";
|
71
72
|
}
|
72
73
|
|
73
74
|
@import "storytime/snippets";
|
@@ -119,6 +119,13 @@
|
|
119
119
|
right: 6px;
|
120
120
|
}
|
121
121
|
|
122
|
+
.dropdown-menu.left:after, .dropdown-menu.left:before {
|
123
|
+
left: 15px;
|
124
|
+
}
|
125
|
+
.dropdown-menu.left:before {
|
126
|
+
left: 15px;
|
127
|
+
}
|
128
|
+
|
122
129
|
.dropdown-menu > li > a {
|
123
130
|
padding: 6px 20px;
|
124
131
|
text-transform: uppercase;
|
@@ -1,76 +1,85 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
.CodeMirror {
|
2
|
+
height: auto;
|
3
|
+
position: absolute;
|
4
|
+
bottom: 0;
|
5
|
+
top: 0;
|
6
|
+
left: 0;
|
7
|
+
right: 0;
|
8
|
+
display: none;
|
9
|
+
}
|
10
10
|
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
.contenteditable {
|
13
|
+
cursor: text;
|
14
|
+
}
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
.contenteditable:empty:before {
|
17
|
+
content: attr(placeholder);
|
18
|
+
color: #ccc;
|
19
|
+
}
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
}
|
21
|
+
.row.page-admin {
|
22
|
+
padding: 10px;
|
23
|
+
&:hover {
|
24
|
+
background: #f1f1f1;
|
26
25
|
}
|
26
|
+
}
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
28
|
+
#tag_cloud {
|
29
|
+
width: 400px;
|
30
|
+
line-height: 1.6em;
|
31
|
+
.s { font-size: 0.8em; }
|
32
|
+
.m { font-size: 1.2em; }
|
33
|
+
.l { font-size: 1.8em; }
|
34
|
+
}
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
}
|
36
|
+
.muted { color: lighten(#333, 50%); }
|
37
|
+
.label {
|
38
|
+
a, a:hover {
|
39
|
+
color: #fff;
|
41
40
|
}
|
41
|
+
}
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
.post_field {
|
44
|
+
margin: 15px 0px;
|
45
|
+
}
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
.notify_subscribers_checkbox {
|
48
|
+
margin-right: 30px;
|
49
|
+
margin-top: -3px;
|
50
|
+
}
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
.post-action-panel {
|
53
|
+
background: #fff;
|
54
|
+
border-bottom: 1px solid #f1f1f1;
|
55
|
+
margin: -20px -20px 20px -20px;
|
56
|
+
}
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
#title_character_limit {
|
59
|
+
position: relative;
|
60
|
+
top: 21px;
|
61
|
+
left: -29px;
|
62
|
+
}
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
.note-editable:empty:before {
|
65
|
+
content: "Write here...";
|
66
|
+
color: #ccc;
|
67
|
+
}
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
69
|
+
#published_at_date, #published_at_time {
|
70
|
+
cursor: pointer;
|
71
|
+
background: #fff;
|
72
|
+
}
|
73
73
|
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
#draft_last_saved_at{
|
75
|
+
margin-left: 25px;
|
76
|
+
}
|
77
|
+
|
78
|
+
.storytime-image{
|
79
|
+
&.pull-left{ margin-right: 15px; }
|
80
|
+
&.pull-right{ margin-left: 15px; }
|
81
|
+
}
|
82
|
+
|
83
|
+
.blog_post_tags{
|
84
|
+
label{ display: block; }
|
85
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Storytime::ApplicationController <
|
1
|
+
class Storytime::ApplicationController < Storytime.application_controller_superclass
|
2
2
|
layout :set_layout
|
3
3
|
|
4
4
|
before_action :ensure_site_exists
|
@@ -7,15 +7,15 @@ class Storytime::ApplicationController < ApplicationController
|
|
7
7
|
include Storytime::Concerns::ControllerContentFor
|
8
8
|
include Storytime::Concerns::CurrentSite
|
9
9
|
helper_method :current_storytime_site
|
10
|
-
|
10
|
+
|
11
11
|
include Pundit
|
12
12
|
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
|
13
|
-
|
13
|
+
|
14
14
|
helper :all
|
15
15
|
|
16
16
|
helper_method :dashboard_controller
|
17
17
|
|
18
|
-
if Storytime.user_class_symbol != :user
|
18
|
+
if Storytime.user_class_symbol != :user && !respond_to(:current_user)
|
19
19
|
helper_method :authenticate_user!
|
20
20
|
helper_method :current_user
|
21
21
|
helper_method :user_signed_in?
|
@@ -35,9 +35,9 @@ class Storytime::ApplicationController < ApplicationController
|
|
35
35
|
|
36
36
|
def setup
|
37
37
|
url = if Storytime.user_class.count == 0
|
38
|
-
|
38
|
+
Storytime.registration_path
|
39
39
|
elsif current_user.nil?
|
40
|
-
|
40
|
+
Storytime.login_path
|
41
41
|
elsif Storytime::Site.count == 0
|
42
42
|
new_dashboard_site_url
|
43
43
|
else
|
@@ -48,6 +48,7 @@ class Storytime::ApplicationController < ApplicationController
|
|
48
48
|
end
|
49
49
|
|
50
50
|
private
|
51
|
+
|
51
52
|
def ensure_site_exists
|
52
53
|
setup if Storytime::Site.count == 0
|
53
54
|
end
|
@@ -66,7 +67,7 @@ private
|
|
66
67
|
ensure
|
67
68
|
Storytime::Site.current_id = nil
|
68
69
|
end
|
69
|
-
|
70
|
+
|
70
71
|
def user_not_authorized
|
71
72
|
flash[:error] = "You are not authorized to perform this action."
|
72
73
|
redirect_to(request.referrer || "/")
|
@@ -5,20 +5,21 @@ module Storytime
|
|
5
5
|
before_action :load_page
|
6
6
|
|
7
7
|
def show
|
8
|
-
if params[:preview].nil? &&
|
8
|
+
if params[:preview].nil? && params[:id].present? && params[:id] != @page.slug
|
9
9
|
return redirect_to @page, :status => :moved_permanently
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
@posts = @page.posts
|
13
13
|
@posts = Storytime.search_adapter.search(params[:search], get_search_type) if (params[:search] && params[:search].length > 0)
|
14
14
|
@posts = @posts.tagged_with(params[:tag]) if params[:tag]
|
15
|
-
@posts = @posts.published.order(published_at: :desc).page(params[:
|
15
|
+
@posts = @posts.published.order(published_at: :desc).page(params[:page_number])
|
16
16
|
|
17
17
|
#allow overriding in the host app
|
18
18
|
render "storytime/#{@current_storytime_site.custom_view_path}/blogs/#{@page.slug}" if lookup_context.template_exists?("storytime/#{@current_storytime_site.custom_view_path}/blogs/#{@page.slug}")
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
22
|
+
|
22
23
|
def load_page
|
23
24
|
@page = if params[:preview]
|
24
25
|
page = Post.find_preview(params[:id])
|
@@ -28,9 +29,13 @@ module Storytime
|
|
28
29
|
else
|
29
30
|
Post.published.friendly.find(params[:id])
|
30
31
|
end
|
31
|
-
|
32
|
+
|
33
|
+
if @page == @current_storytime_site.homepage
|
34
|
+
opts = params[:tag] ? { tag: params[:tag] } : {}
|
35
|
+
redirect_to storytime.root_path(opts), status: :moved_permanently
|
36
|
+
end
|
32
37
|
end
|
33
|
-
|
38
|
+
|
34
39
|
def get_search_type
|
35
40
|
if params[:type]
|
36
41
|
legal_search_types(params[:type])
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_dependency "storytime/dashboard/posts_controller"
|
2
|
+
|
3
|
+
module Storytime
|
4
|
+
module Dashboard
|
5
|
+
class LinksController < DashboardController
|
6
|
+
def sort
|
7
|
+
authorize current_storytime_site, :manage?
|
8
|
+
@navigation = Navigation.find(params[:navigation_id])
|
9
|
+
params[:link].each_with_index do |id, index|
|
10
|
+
@navigation.links.where(id: id).update_all({position: index+1})
|
11
|
+
end
|
12
|
+
render nothing: true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|