storytime 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -2
  3. data/Gemfile.lock +238 -185
  4. data/README.md +21 -21
  5. data/app/assets/javascripts/storytime/application.js +5 -3
  6. data/app/assets/javascripts/storytime/base.js.coffee +5 -4
  7. data/app/assets/javascripts/storytime/media.js.coffee +7 -2
  8. data/app/assets/javascripts/storytime/{users.js.coffee → memberships.js.coffee} +3 -4
  9. data/app/assets/javascripts/storytime/navigations.js.coffee +7 -0
  10. data/app/assets/javascripts/storytime/wysiwyg.js.coffee +23 -11
  11. data/app/assets/stylesheets/storytime/application.scss +2 -1
  12. data/app/assets/stylesheets/storytime/dashboard_overrides.scss +4 -0
  13. data/app/assets/stylesheets/storytime/media.scss +2 -0
  14. data/app/assets/stylesheets/storytime/navigation.scss +7 -0
  15. data/app/assets/stylesheets/storytime/posts.scss +70 -61
  16. data/app/controllers/storytime/application_controller.rb +8 -7
  17. data/app/controllers/storytime/blogs_controller.rb +10 -5
  18. data/app/controllers/storytime/dashboard/blogs_controller.rb +0 -1
  19. data/app/controllers/storytime/dashboard/custom_posts_controller.rb +1 -1
  20. data/app/controllers/storytime/dashboard/links_controller.rb +16 -0
  21. data/app/controllers/storytime/dashboard/memberships_controller.rb +56 -6
  22. data/app/controllers/storytime/dashboard/navigations_controller.rb +66 -0
  23. data/app/controllers/storytime/dashboard/pages_controller.rb +7 -3
  24. data/app/controllers/storytime/dashboard/posts_controller.rb +7 -5
  25. data/app/controllers/storytime/dashboard/sites_controller.rb +1 -1
  26. data/app/controllers/storytime/dashboard_controller.rb +3 -3
  27. data/app/controllers/storytime/pages_controller.rb +3 -3
  28. data/app/helpers/storytime/application_helper.rb +9 -1
  29. data/app/models/concerns/storytime/scoped_to_site.rb +5 -3
  30. data/app/models/storytime/blog.rb +0 -1
  31. data/app/models/storytime/link.rb +22 -0
  32. data/app/models/storytime/membership.rb +2 -0
  33. data/app/models/storytime/navigation.rb +19 -0
  34. data/app/models/storytime/post.rb +8 -4
  35. data/app/models/storytime/site.rb +3 -2
  36. data/app/policies/storytime/membership_policy.rb +13 -1
  37. data/app/policies/storytime/snippet_policy.rb +5 -1
  38. data/app/views/layouts/storytime/dashboard.html.erb +2 -1
  39. data/app/views/storytime/application/storytime/_header.html.erb +1 -0
  40. data/app/views/storytime/blogs/_tags.html.erb +1 -1
  41. data/app/views/storytime/blogs/show.html.erb +1 -1
  42. data/app/views/storytime/dashboard/_navigation.html.erb +12 -8
  43. data/app/views/storytime/dashboard/_settings_tabs.html.erb +1 -1
  44. data/app/views/storytime/dashboard/blog_posts/edit.html.erb +1 -1
  45. data/app/views/storytime/dashboard/blog_posts/new.html.erb +1 -1
  46. data/app/views/storytime/dashboard/blogs/_blog.html.erb +1 -1
  47. data/app/views/storytime/dashboard/media/_gallery.html.erb +12 -11
  48. data/app/views/storytime/dashboard/{users → memberships}/_edit.html.erb +6 -7
  49. data/app/views/storytime/dashboard/memberships/_index.html.erb +1 -1
  50. data/app/views/storytime/dashboard/memberships/_membership.html.erb +1 -1
  51. data/app/views/storytime/dashboard/{users → memberships}/_new.html.erb +3 -3
  52. data/app/views/storytime/dashboard/memberships/edit.json.jbuilder +2 -0
  53. data/app/views/storytime/dashboard/memberships/new.json.jbuilder +2 -0
  54. data/app/views/storytime/dashboard/memberships/save.json.jbuilder +1 -1
  55. data/app/views/storytime/dashboard/navigations/_blog_link_fields.html.erb +8 -0
  56. data/app/views/storytime/dashboard/navigations/_external_link_fields.html.erb +7 -0
  57. data/app/views/storytime/dashboard/navigations/_form.html.erb +58 -0
  58. data/app/views/storytime/dashboard/navigations/_navigation.html.erb +25 -0
  59. data/app/views/storytime/dashboard/navigations/_page_link_fields.html.erb +8 -0
  60. data/app/views/storytime/dashboard/navigations/edit.html.erb +1 -0
  61. data/app/views/storytime/dashboard/navigations/index.html.erb +15 -0
  62. data/app/views/storytime/dashboard/navigations/new.html.erb +1 -0
  63. data/app/views/storytime/dashboard/pages/edit.html.erb +1 -1
  64. data/app/views/storytime/dashboard/pages/new.html.erb +1 -1
  65. data/app/views/storytime/dashboard/posts/_image_toolbar.html.erb +4 -1
  66. data/app/views/storytime/dashboard/posts/_list.html.erb +10 -8
  67. data/app/views/storytime/dashboard/posts/edit.html.erb +1 -1
  68. data/app/views/storytime/dashboard/posts/index.html.erb +16 -5
  69. data/app/views/storytime/dashboard/posts/new.html.erb +1 -1
  70. data/app/views/storytime/navigations/_navigation.html.erb +3 -0
  71. data/app/views/storytime/posts/_post.html.erb +1 -1
  72. data/app/views/storytime/posts/_tags.html.erb +1 -1
  73. data/app/views/storytime/sites/_google_analytics_code.html.erb +4 -3
  74. data/app/views/storytime/snippets/_snippet.html.erb +1 -1
  75. data/config/initializers/assets.rb +1 -1
  76. data/config/initializers/storytime_admin.rb +2 -0
  77. data/config/initializers/url_for_patch.rb +6 -6
  78. data/config/locales/en.yml +18 -0
  79. data/config/routes.rb +11 -10
  80. data/db/migrate/20141021073356_create_storytime_snippets.rb +1 -1
  81. data/db/migrate/20150520181115_create_storytime_navigations.rb +12 -0
  82. data/db/migrate/20150520185227_create_storytime_links.rb +11 -0
  83. data/db/migrate/20150520190700_add_position_to_storytime_links.rb +6 -0
  84. data/db/migrate/20150529192058_add_url_to_storytime_links.rb +5 -0
  85. data/lib/generators/storytime/views_generator.rb +2 -3
  86. data/lib/generators/templates/storytime.rb +22 -15
  87. data/lib/storytime/concerns/current_site.rb +1 -1
  88. data/lib/storytime/concerns/has_versions.rb +8 -8
  89. data/lib/storytime/constraints/page_constraint.rb +2 -2
  90. data/lib/storytime/engine.rb +2 -0
  91. data/lib/storytime/storytime_helpers.rb +7 -5
  92. data/lib/storytime/version.rb +1 -1
  93. data/lib/storytime.rb +29 -11
  94. data/spec/controllers/dashboard_controller_spec.rb +4 -4
  95. data/spec/dummy/config/environments/test.rb +1 -1
  96. data/spec/dummy/db/schema.rb +61 -35
  97. data/spec/factories/navigation_factories.rb +6 -0
  98. data/spec/features/blogs_spec.rb +2 -2
  99. data/spec/features/comments_spec.rb +4 -4
  100. data/spec/features/dashboard/media_spec.rb +7 -7
  101. data/spec/features/dashboard/memberships_spec.rb +62 -4
  102. data/spec/features/dashboard/navigations_spec.rb +33 -0
  103. data/spec/features/dashboard/pages_spec.rb +26 -16
  104. data/spec/features/dashboard/posts_spec.rb +65 -15
  105. data/spec/features/dashboard/sites_spec.rb +5 -5
  106. data/spec/features/dashboard/snippets_spec.rb +5 -5
  107. data/spec/features/dashboard/subscription_spec.rb +5 -5
  108. data/spec/features/pages_spec.rb +3 -3
  109. data/spec/features/posts_spec.rb +1 -1
  110. data/spec/features/subscription_spec.rb +2 -2
  111. data/spec/lib/storytime_helpers_spec.rb +37 -0
  112. data/spec/models/navigation_spec.rb +21 -0
  113. data/spec/requests/routings_spec.rb +8 -8
  114. data/spec/spec_helper.rb +5 -5
  115. data/spec/support/feature_macros.rb +1 -1
  116. data/storytime.gemspec +6 -4
  117. metadata +69 -23
  118. data/app/views/storytime/dashboard/users/edit.json.jbuilder +0 -2
  119. data/app/views/storytime/dashboard/users/new.json.jbuilder +0 -2
  120. data/screenshots/admin.png +0 -0
  121. data/screenshots/media.png +0 -0
  122. data/screenshots/page-list.png +0 -0
  123. data/screenshots/post-editor.png +0 -0
  124. data/screenshots/site-settings.png +0 -0
  125. data/screenshots/text-snippets.png +0 -0
  126. data/screenshots/user-management.png +0 -0
  127. 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/FlyoverWorks/storytime/tree/master.svg?style=svg)](https://circleci.com/gh/FlyoverWorks/storytime/tree/master)
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 [FlyoverWorks](http://www.flyoverworks.com) / [@flyoverworks](http://twitter.com/flyoverworks)
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/FlyoverWorks/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/FlyoverWorks/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/FlyoverWorks/storytime/wiki/Multi-site-Support) - Manage multiple sites with one Storytime deployment.
12
- * [Inline text snippet editing](https://github.com/FlyoverWorks/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/FlyoverWorks/storytime/wiki/Admin-of-Rails-Models) - Manage your models from the Storytime dashboard.
14
- * [Custom Post Types](https://github.com/FlyoverWorks/storytime/wiki/Using-Custom-Post-Types) - Add custom post types to alter functionality or appearance of posts.
15
- * [Email list building](https://github.com/FlyoverWorks/storytime/wiki/Email-Subscriptions) - Collect and manage emails using a simple view helper.
16
- * [New post notifications](https://github.com/FlyoverWorks/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/FlyoverWorks/storytime/wiki/Using-Storytime%27s-Post-Search) - Easily search through Storytime's posts using built-in search adapters or request parameters.
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/flyoverworks/storytime-example)
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/FlyoverWorks/storytime/wiki) for more documentation and information on using Storytime's various features.
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/FlyoverWorks/storytime/master/screenshots/page-list.png "Page List")
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/FlyoverWorks/storytime/master/screenshots/post-editor.png "Post Editor")
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/FlyoverWorks/storytime/master/screenshots/admin.png "Admin of Custom Rails Models")
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/FlyoverWorks/storytime/master/screenshots/text-snippets.png "Text Snippets")
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/FlyoverWorks/storytime/master/screenshots/user-management.png "User Management")
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/FlyoverWorks/storytime/master/screenshots/site-settings.png "Site Settings")
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/FlyoverWorks/storytime/master/screenshots/media.png "Media Uploads")
157
+ ![Media Uploads](https://raw.githubusercontent.com/CultivateLabs/storytime/master/screenshots/media.png "Media Uploads")
158
158
 
159
159
  ## Copyright
160
- Copyright © 2014-2015 FlyoverWorks Inc. Storytime is released under the [MIT-LICENSE](MIT-LICENSE).
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
- url = $(this).data('url')
27
- document.location.href = url
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 = "<img src='#{$(@).data("image-url")}' class='img-responsive' />"
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.Users
1
+ class Storytime.Dashboard.Memberships
2
2
  initIndex: () ->
3
3
  $(".chosen").chosen
4
- width: '100%'
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: '100%'
9
+ width: "100%"
@@ -0,0 +1,7 @@
1
+ class Storytime.Dashboard.Navigations
2
+ initIndex: ()->
3
+ $('.sortable').sortable
4
+ axis: 'y'
5
+ handle: '.fa-bars'
6
+ update: ->
7
+ $.post($(this).data('update-url'), $(this).sortable('serialize'))
@@ -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
- $(".medium-active-image").css("width", "")
77
+ $img.css("width", "")
69
78
  $("#medium-image-height").val("")
70
79
  $("#medium-image-width").val("")
71
80
  else
72
- $(".medium-active-image").css("width", $(this).val())
73
- $(".medium-active-image").css("height", "")
74
- $("#medium-image-height").val($(".medium-active-image").css("height"))
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
- image = $(".medium-active-image")
99
+ container = $(".medium-active-image").parent(".storytime-image")
88
100
  switch direction
89
- when "left" then image.removeClass("pull-right pull-left").addClass("pull-left")
90
- when "right" then image.removeClass("pull-right pull-left").addClass("pull-right")
91
- when "none" then image.removeClass("pull-right pull-left")
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 = tidy_html5 wysiwyg.find('.medium-editor').html(), tidyOptions
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(http://fonts.googleapis.com/css?family=Merriweather:400,300,700,900|Open+Sans:400,300,600);
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";
@@ -0,0 +1,4 @@
1
+ /*
2
+ * Add app/assets/stylesheets/storytime/dashboard_overrides.scss to your host
3
+ * app and include any necessary css/sass needed to override dashboard styles.
4
+ */
@@ -4,6 +4,8 @@
4
4
 
5
5
  img {
6
6
  cursor: pointer;
7
+ &.pull-left{ margin-right: 20px; }
8
+ &.pull-right{ margin-left: 20px; }
7
9
  }
8
10
  }
9
11
 
@@ -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
- .CodeMirror {
2
- height: auto;
3
- position: absolute;
4
- bottom: 0;
5
- top: 0;
6
- left: 0;
7
- right: 0;
8
- display: none;
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
- .contenteditable {
13
- cursor: text;
14
- }
12
+ .contenteditable {
13
+ cursor: text;
14
+ }
15
15
 
16
- .contenteditable:empty:before {
17
- content: attr(placeholder);
18
- color: #ccc;
19
- }
16
+ .contenteditable:empty:before {
17
+ content: attr(placeholder);
18
+ color: #ccc;
19
+ }
20
20
 
21
- .row.page-admin {
22
- padding: 10px;
23
- &:hover {
24
- background: #f1f1f1;
25
- }
21
+ .row.page-admin {
22
+ padding: 10px;
23
+ &:hover {
24
+ background: #f1f1f1;
26
25
  }
26
+ }
27
27
 
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
- }
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
- .muted { color: lighten(#333, 50%); }
37
- .label {
38
- a, a:hover {
39
- color: #fff;
40
- }
36
+ .muted { color: lighten(#333, 50%); }
37
+ .label {
38
+ a, a:hover {
39
+ color: #fff;
41
40
  }
41
+ }
42
42
 
43
- .post_field {
44
- margin: 15px 0px;
45
- }
43
+ .post_field {
44
+ margin: 15px 0px;
45
+ }
46
46
 
47
- .notify_subscribers_checkbox {
48
- margin-right: 30px;
49
- margin-top: -3px;
50
- }
47
+ .notify_subscribers_checkbox {
48
+ margin-right: 30px;
49
+ margin-top: -3px;
50
+ }
51
51
 
52
- .post-action-panel {
53
- background: #fff;
54
- border-bottom: 1px solid #f1f1f1;
55
- margin: -20px -20px 20px -20px;
56
- }
52
+ .post-action-panel {
53
+ background: #fff;
54
+ border-bottom: 1px solid #f1f1f1;
55
+ margin: -20px -20px 20px -20px;
56
+ }
57
57
 
58
- #title_character_limit {
59
- position: relative;
60
- top: 21px;
61
- left: -29px;
62
- }
58
+ #title_character_limit {
59
+ position: relative;
60
+ top: 21px;
61
+ left: -29px;
62
+ }
63
63
 
64
- .note-editable:empty:before {
65
- content: "Write here...";
66
- color: #ccc;
67
- }
64
+ .note-editable:empty:before {
65
+ content: "Write here...";
66
+ color: #ccc;
67
+ }
68
68
 
69
- #published_at_date, #published_at_time {
70
- cursor: pointer;
71
- background: #fff;
72
- }
69
+ #published_at_date, #published_at_time {
70
+ cursor: pointer;
71
+ background: #fff;
72
+ }
73
73
 
74
- #draft_last_saved_at{
75
- margin-left: 25px;
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 < 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
- main_app.new_user_registration_url
38
+ Storytime.registration_path
39
39
  elsif current_user.nil?
40
- main_app.new_user_session_url
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? && ((params[:id] != @page.slug) && (request.path != "/"))
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[:page])
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
- redirect_to "/", status: :moved_permanently if @page == @current_storytime_site.homepage
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])
@@ -32,7 +32,6 @@ module Storytime
32
32
  def create
33
33
  @blog = current_post_type.new(post_params)
34
34
  @blog.user = current_user
35
- @blog.draft_content = "test"
36
35
  @blog.draft_user_id = current_user.id
37
36
  @blog.published_at = Time.now.utc
38
37
  authorize @blog
@@ -33,7 +33,7 @@ module Storytime
33
33
 
34
34
  private
35
35
  def current_post_type
36
- @current_post_type ||= request.path.split("/")[4].classify.constantize
36
+ @current_post_type ||= params[:post_type].classify.constantize
37
37
  end
38
38
  helper_method :current_post_type
39
39
 
@@ -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