kit_cms 2.3.16 → 2.3.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/app/assets/images/kit/toolbar/bold.png +0 -0
  2. data/app/assets/images/kit/toolbar/formatted.png +0 -0
  3. data/app/assets/images/kit/toolbar/image.png +0 -0
  4. data/app/assets/images/kit/toolbar/link.png +0 -0
  5. data/app/assets/images/kit/toolbar/list.png +0 -0
  6. data/app/assets/images/kit/toolbar/numbered_list.png +0 -0
  7. data/app/assets/images/kit/toolbar/preview.png +0 -0
  8. data/app/assets/images/kit/toolbar/quote.png +0 -0
  9. data/app/assets/images/kit/toolbar/redo.png +0 -0
  10. data/app/assets/images/kit/toolbar/underline.png +0 -0
  11. data/app/assets/images/kit/toolbar/undo.png +0 -0
  12. data/app/assets/images/kit/toolbar/video.png +0 -0
  13. data/app/assets/javascripts/codemirror/editor.js +183 -0
  14. data/app/assets/javascripts/codemirror/markdown.js +475 -0
  15. data/app/assets/javascripts/jquery.contextmenu.js +7 -7
  16. data/app/assets/javascripts/kit/kit.js +0 -1
  17. data/app/assets/javascripts/kit/markdown.js +1 -37
  18. data/app/assets/javascripts/kit/tree.js +18 -10
  19. data/app/assets/javascripts/kit/utilities.js +1 -1
  20. data/app/assets/stylesheets/codemirror/editor.css +3 -3
  21. data/app/assets/stylesheets/codemirror/theme.css +76 -1
  22. data/app/assets/stylesheets/kit/calendar.css +58 -97
  23. data/app/assets/stylesheets/kit/cms/cms.css +19 -0
  24. data/app/assets/stylesheets/kit/cms/dsc_tree.css +4 -0
  25. data/app/assets/stylesheets/kit/forums.css +30 -0
  26. data/app/assets/stylesheets/kit/kit.css +0 -1
  27. data/app/controllers/admin/dashboard_controller.rb +11 -2
  28. data/app/controllers/admin/page_templates_controller.rb +14 -1
  29. data/app/controllers/admin/user_controller.rb +2 -3
  30. data/app/controllers/category_controller.rb +5 -6
  31. data/app/controllers/form_controller.rb +1 -1
  32. data/app/controllers/forum_controller.rb +2 -2
  33. data/app/controllers/kit_controller.rb +2 -2
  34. data/app/controllers/pages_controller.rb +24 -0
  35. data/app/controllers/user/passwords_controller.rb +2 -0
  36. data/app/controllers/user/registrations_controller.rb +1 -4
  37. data/app/controllers/user/sessions_controller.rb +2 -0
  38. data/app/controllers/user/unlocks_controller.rb +2 -0
  39. data/app/controllers/user_controller.rb +1 -1
  40. data/app/helpers/calendar_helper.rb +4 -1
  41. data/app/helpers/kit_helper.rb +3 -3
  42. data/app/mailers/notification.rb +3 -3
  43. data/app/models/activity.rb +5 -2
  44. data/app/models/calendar.rb +1 -1
  45. data/app/models/category.rb +18 -4
  46. data/app/models/experiment.rb +2 -0
  47. data/app/models/form_submission.rb +2 -2
  48. data/app/models/html_asset.rb +3 -0
  49. data/app/models/mapping.rb +1 -0
  50. data/app/models/user.rb +1 -1
  51. data/app/views/admin/blocks/_form.html.haml +1 -1
  52. data/app/views/admin/dashboard/user_comments.html.haml +19 -8
  53. data/app/views/admin/experiments/show.html.haml +1 -1
  54. data/app/views/admin/form/_form.html.haml +8 -0
  55. data/app/views/admin/page_templates/_form.html.haml +1 -1
  56. data/app/views/admin/views/_form.html.haml +4 -4
  57. data/app/views/calendar/_calendar_scripts.js.erb +2 -2
  58. data/app/views/calendar/_month.html.haml +58 -27
  59. data/app/views/category/_select_options.html.erb +1 -1
  60. data/app/views/form/_show.html.haml +9 -1
  61. data/app/views/forum/_add_post.html.haml +3 -2
  62. data/app/views/forum/_mod_thread.js.erb +2 -2
  63. data/app/views/forum/_post_scripts.js.erb +1 -2
  64. data/app/views/forum/thread.html.haml +4 -0
  65. data/app/views/layouts/_application.html.erb +1 -0
  66. data/app/views/layouts/minimal.html.erb +2 -2
  67. data/app/views/notification/form_submission.text.erb +2 -0
  68. data/app/views/pages/_form.html.haml +7 -8
  69. data/app/views/pages/_page_scripts.js.erb +1 -3
  70. data/app/views/pages/_page_template_script.js.erb +28 -0
  71. data/app/views/pages/cookie_text.html.haml +1 -1
  72. data/app/views/pages/info.html.erb +2 -2
  73. data/app/views/pages/page_template.html.haml +40 -0
  74. data/app/views/utility/_cm_editor.html.erb +34 -5
  75. data/app/views/utility/_cm_toolbar_markdown.html.haml +49 -0
  76. data/config/initializers/devise_extender.rb +9 -0
  77. data/config/initializers/html_assets.rb +4 -0
  78. data/config/initializers/quiet_asserts.rb +1 -1
  79. data/config/routes.rb +2 -0
  80. metadata +21 -3
@@ -1,5 +1,5 @@
1
1
  %p
2
- = kit_snippet('cookie-text', 'If you want to use this website, to comply with EU legislation, you need to grant us the right to place cookies in your webbrowser. If you do not agree to this then unfortunately you will be unable to use this website. <a href="/cookies">More info</a>.'.html_safe)
2
+ = kit_snippet('cookie-text', 'If you want to use this website, to comply with EU legislation, you need to grant us the right to place cookies in your webbrowser. If you do not agree to this then unfortunately you will be unable to use this website. <a href="/cookies">More info</a>.'.html_safe, _sid)
3
3
 
4
4
  %p(style="margin-top: 10px; width: 60px; margin-left: auto; margin-right: auto;")
5
5
  = button_to_function "Grant", "accept_cookies();", :name=>"grant"
@@ -65,7 +65,6 @@ return false;
65
65
  <td><%= @page.locked? ? "Yes" : "No" %></td>
66
66
  <td><%= link_to @page.locked? ? "No" : "Yes", "/page/#{@page.id}/info?locked=#{!@page.locked?}", :class=>"action", :method=>:post %></td>
67
67
  </tr>
68
-
69
68
 
70
69
  <tr>
71
70
  <td>Path:</td>
@@ -73,7 +72,8 @@ return false;
73
72
  </tr>
74
73
  <tr>
75
74
  <td>Template:</td>
76
- <td colspan='2'><%= link_to(@page.page_template.name, "/admin/page_templates/#{@page.page_template_id}") rescue '' %></td>
75
+ <td><%= link_to(@page.page_template.name, "/admin/page_templates/#{@page.page_template_id}") rescue '' %></td>
76
+ <td><%= icon_to "Change", "/page/#{@page.id}/page_template", false, :style=>"position:relative; left: -3px;" %></td>
77
77
  </tr>
78
78
 
79
79
  <% if @page.page_template && @page.page_template.has_mobile_version? && feature?("mobile_templates") %>
@@ -0,0 +1,40 @@
1
+ - content_for :head do
2
+ %script(type='text/javascript')
3
+ = render :partial=>"/pages/page_template_script", :formats=>:js, :locals=>{:current=>@page.page_template_id}
4
+
5
+ - content_for :main do
6
+
7
+ %h1.page_icon Page Template for '#{@page.title}'
8
+
9
+ %h3
10
+ Current Template:
11
+ = @page.page_template.name
12
+
13
+ %h3
14
+ New Template
15
+
16
+ = form_for @page , :url=>"/page/#{@page.id}/page_template" do |f|
17
+ = f.select :page_template_id, options_from_collection_for_select(PageTemplate.sys(_sid).order(:display_order).all, :id, :name, @page.page_template_id)
18
+
19
+ #error_explanation(style="display: none;")
20
+
21
+ - contents = @page.current_content
22
+ %ul#mapping(style="display: none;")
23
+ %li
24
+ %h3 Editable Region Mappings
25
+ %p
26
+ When moving to a new template you must map the editable regions for the current page
27
+ to the the ones present in the new template. Where the name matches they have already
28
+ been selected. Make the other selections as appropriate and click Save to make the change.
29
+ %span.check_error
30
+ The contents of any regions which are not mapped will be discarded.
31
+
32
+ - contents.each do |content|
33
+ %li(id="field_#{content.id}")
34
+ %label
35
+ = content.field_name
36
+ = select_tag "f_#{content.field_name}", "<option></option>".html_safe, {:class=>"field_select", "data-name"=>content.field_name}
37
+
38
+ %li(style='margin-top: 10px;')
39
+ = kit_submit "Save"
40
+
@@ -1,17 +1,46 @@
1
1
  <script type="text/javascript">
2
2
  $(document).ready(function() {
3
3
  var editor_a = parent.document.getElementById('<%= form_field %>');
4
- var options = { lineNumbers: true, theme: 'blackboard-cms', indentUnit: 2, lineWrapping: true, matchBrackets: true , collapseRange: true, mode : '<%= mode %>'};
5
- html_editor = parent.CodeMirror.fromTextArea(editor_a, options);
4
+ var options = {
5
+ <% unless options[:dont_show_line_numbers] %>
6
+ lineNumbers: true,
7
+ <% end %>
8
+ theme: "<%= options[:theme] || 'blackboard-cms' %>",
9
+ indentUnit: 2,
10
+ lineWrapping: true,
11
+ matchBrackets: true,
12
+ collapseRange: true,
13
+ mode : '<%= mode %>'};
14
+ var html_editor = parent.CodeMirror.fromTextArea(editor_a, options);
15
+ html_editors["<%= form_field %>"] = html_editor;
6
16
  html_editor.focus();
7
-
17
+ <% height = options[:height] %>
18
+ <% width = options[:width] %>
19
+ <% if height || width %>
20
+ <% width = width ? "\"#{width}\"" : 'null' %>
21
+ <% height = height ? "\"#{height}\"" : 'null' %>
22
+ <%= "html_editor.setSize(#{width}, #{height})".html_safe %>
23
+ <% end %>
24
+
8
25
  });
9
26
  </script>
10
27
 
11
- <div id='editor_mode'>Mode: <%= (mode=='htmlmixed' ? 'html' : mode).upcase %>
28
+ <% unless options[:dont_show_mode] %>
29
+ <div class='editor_mode'>Mode: <%= (mode=='htmlmixed' ? 'html' : mode).upcase %>
12
30
  </div>
31
+ <% end %>
13
32
 
14
- <%= form.text_area field %>
33
+ <% if options[:show_toolbar] %>
34
+ <div class='toolbar'>
35
+ <%= render :partial=>"utility/cm_toolbar_#{mode}", :locals=>{:name=>form_field} %>
36
+ </div>
37
+ <% end %>
15
38
 
39
+ <%= form.text_area field %>
16
40
 
41
+ <% unless options[:no_preview] %>
42
+ <div id="preview_<%= form_field %>" class='markdown_preview' style='display: none;'>
43
+ Please wait whilst the preview loads
44
+ </div>
45
+ <% end %>
17
46
 
@@ -0,0 +1,49 @@
1
+ - rand = rand(100000)
2
+
3
+
4
+ %ul.markdown.clearfix(id="tb_#{rand}")
5
+
6
+ %li.bold(data-cmd="undo" data-hint="Undo")
7
+ = image_tag "/assets/kit/toolbar/undo.png"
8
+ %label Undo
9
+ %li.spacer.bold(data-cmd="redo" data-hint="Redo")
10
+ = image_tag "/assets/kit/toolbar/redo.png"
11
+ %label Redo
12
+
13
+ %li.bold(data-cmd="bold" data-hint="Bold")
14
+ = image_tag "/assets/kit/toolbar/bold.png"
15
+ %label Bold
16
+ %li.spacer.underline(data-cmd="underline" data-hint="Underline")
17
+ = image_tag "/assets/kit/toolbar/underline.png"
18
+ %label Underline
19
+ %li.list(data-cmd="list" data-hint="Bullet Point List")
20
+ = image_tag "/assets/kit/toolbar/list.png"
21
+ %label List
22
+ %li.spacer.numbered_list(data-cmd="numbered_list" data-hint="Numbered List")
23
+ = image_tag "/assets/kit/toolbar/numbered_list.png"
24
+ %label Numbered
25
+ %li.image(data-cmd="image" data-hint="Insert Image")
26
+ = image_tag "/assets/kit/toolbar/image.png"
27
+ %label Image
28
+ %li.link(data-cmd="link" data-hint="Insert Link")
29
+ = image_tag "/assets/kit/toolbar/link.png"
30
+ %label Link
31
+ %li.spacer.link(data-cmd="video" data-hint="Insert Video")
32
+ = image_tag "/assets/kit/toolbar/video.png"
33
+ %label Video
34
+ %li.quote(data-cmd="quote" data-hint="Quote")
35
+ = image_tag "/assets/kit/toolbar/quote.png"
36
+ %label Quote
37
+ %li.spacer.pre(data-cmd="pre" data-hint="Preformatted")
38
+ = image_tag "/assets/kit/toolbar/formatted.png"
39
+ %label Formatted
40
+ %li.pre(data-cmd="preview" data-hint="Preview")
41
+ = image_tag "/assets/kit/toolbar/preview.png"
42
+ %label Preview
43
+
44
+ %script
45
+ $(document).ready(function() {
46
+ $('#tb_#{rand} li').on('click', function() {
47
+ if ($(this).attr('data-cmd')) { do_cmd("#{name}", $(this).attr('data-cmd')); }
48
+ });
49
+ });
@@ -20,6 +20,7 @@ module DeviseExtender
20
20
  options[:type] = custom_template.template_type || 'erb'
21
21
  options[:inline] = custom_template.body
22
22
  options[:layout] = custom_template.layout.path
23
+
23
24
  super options
24
25
  else
25
26
  super name, options
@@ -27,4 +28,12 @@ module DeviseExtender
27
28
  end
28
29
 
29
30
 
31
+ def stylesheets
32
+ custom_template = PageTemplate.get_custom_template(_sid, kit_template ? kit_template : name, request)
33
+ if custom_template
34
+ return custom_template.layout.stylesheets.split(',').uniq
35
+ else
36
+ return ["application"]
37
+ end
38
+ end
30
39
  end
@@ -0,0 +1,4 @@
1
+
2
+ HtmlAsset.find_each do |ha|
3
+ ha.write_to_file
4
+ end
@@ -1,4 +1,4 @@
1
- Rails.application.assets.logger = Logger.new('/dev/null')
1
+ #Rails.application.assets.logger = Logger.new('/dev/null')
2
2
  Rails::Rack::Logger.class_eval do
3
3
  def call_with_quiet_assets(env)
4
4
  previous_level = Rails.logger.level
@@ -48,6 +48,7 @@ Rails.application.routes.draw do
48
48
  post "/admin/calendar_entries/:id" => "admin/calendar_entries#show"
49
49
  get "/admin/calendars/:calendar_id/:start_date/:id" => "admin/calendar_entries#show"
50
50
  get "/admin/page_templates/:id/pages" => "admin/page_templates#pages"
51
+ get "/admin/page_templates/:id/mapping" => "admin/page_templates#mapping"
51
52
  match "/tickets/:item_model/:item_id" => "calendar#buy_tickets"
52
53
  get "/tickets/sold_as_csv/:item_model/:item_id" => "calendar#sold_as_csv"
53
54
 
@@ -316,6 +317,7 @@ Rails.application.routes.draw do
316
317
  get 'pages/zoom' => 'pages#zoom'
317
318
  post 'page/unique' => 'pages#unique'
318
319
  get 'page/info' => 'pages#info'
320
+ match 'page/:id/page_template' => 'pages#page_template', :only=>[:get, :post]
319
321
  post 'page/:id/copy' => 'pages#copy'
320
322
  delete 'page/:id/terms/:term_id' => 'pages#terms'
321
323
  match '/page/:id/terms' => 'pages#terms'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kit_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.16
4
+ version: 2.3.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-22 00:00:00.000000000 Z
12
+ date: 2013-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -428,7 +428,7 @@ dependencies:
428
428
  - !ruby/object:Gem::Version
429
429
  version: '0'
430
430
  - !ruby/object:Gem::Dependency
431
- name: rdiscount
431
+ name: rdiscount-dsc
432
432
  requirement: !ruby/object:Gem::Requirement
433
433
  none: false
434
434
  requirements:
@@ -2360,6 +2360,18 @@ files:
2360
2360
  - app/assets/images/kit/icons/white/48/wrench_plus_icon&48.png
2361
2361
  - app/assets/images/kit/icons/white/48/youtube_icon&48.png
2362
2362
  - app/assets/images/kit/icons/white/48/zoom_icon&48.png
2363
+ - app/assets/images/kit/toolbar/bold.png
2364
+ - app/assets/images/kit/toolbar/formatted.png
2365
+ - app/assets/images/kit/toolbar/image.png
2366
+ - app/assets/images/kit/toolbar/link.png
2367
+ - app/assets/images/kit/toolbar/list.png
2368
+ - app/assets/images/kit/toolbar/numbered_list.png
2369
+ - app/assets/images/kit/toolbar/preview.png
2370
+ - app/assets/images/kit/toolbar/quote.png
2371
+ - app/assets/images/kit/toolbar/redo.png
2372
+ - app/assets/images/kit/toolbar/underline.png
2373
+ - app/assets/images/kit/toolbar/undo.png
2374
+ - app/assets/images/kit/toolbar/video.png
2363
2375
  - app/assets/images/kit/wait.gif
2364
2376
  - app/assets/images/menu/logo.png
2365
2377
  - app/assets/images/menu/menu_bg.gif
@@ -2392,6 +2404,7 @@ files:
2392
2404
  - app/assets/javascripts/codemirror/javascript.js
2393
2405
  - app/assets/javascripts/codemirror/jquery.js
2394
2406
  - app/assets/javascripts/codemirror/loadmode.js
2407
+ - app/assets/javascripts/codemirror/markdown.js
2395
2408
  - app/assets/javascripts/codemirror/match-highlighter.js
2396
2409
  - app/assets/javascripts/codemirror/matchbrackets.js
2397
2410
  - app/assets/javascripts/codemirror/multiplex.js
@@ -3111,6 +3124,7 @@ files:
3111
3124
  - app/views/images/index.html.haml
3112
3125
  - app/views/images/index.js.erb
3113
3126
  - app/views/images/media_modal.html.erb
3127
+ - app/views/layouts/_application.html.erb
3114
3128
  - app/views/layouts/_cms-common.html.erb
3115
3129
  - app/views/layouts/_html-editor.html.haml
3116
3130
  - app/views/layouts/_kit_header.html.haml
@@ -3162,6 +3176,7 @@ files:
3162
3176
  - app/views/pages/_mercury-notes.html.haml
3163
3177
  - app/views/pages/_meta.html.erb
3164
3178
  - app/views/pages/_page_scripts.js.erb
3179
+ - app/views/pages/_page_template_script.js.erb
3165
3180
  - app/views/pages/_search_form.html.haml
3166
3181
  - app/views/pages/_search_results.html.haml
3167
3182
  - app/views/pages/_term.html.haml
@@ -3183,6 +3198,7 @@ files:
3183
3198
  - app/views/pages/mock.html.haml
3184
3199
  - app/views/pages/new.html.erb
3185
3200
  - app/views/pages/notes.html.haml
3201
+ - app/views/pages/page_template.html.haml
3186
3202
  - app/views/pages/remove_term.js.erb
3187
3203
  - app/views/pages/save_content.rjs
3188
3204
  - app/views/pages/search.html.erb
@@ -3200,6 +3216,7 @@ files:
3200
3216
  - app/views/user/user_profile.html.haml
3201
3217
  - app/views/utility/_button_to_with_params.html.haml
3202
3218
  - app/views/utility/_cm_editor.html.erb
3219
+ - app/views/utility/_cm_toolbar_markdown.html.haml
3203
3220
  - app/views/utility/_design_history.html.haml
3204
3221
  - app/views/utility/_fetch_rss.html.erb
3205
3222
  - app/views/utility/_map.html.haml
@@ -3224,6 +3241,7 @@ files:
3224
3241
  - config/initializers/geokit_config.rb
3225
3242
  - config/initializers/haml.rb
3226
3243
  - config/initializers/honeypot.rb
3244
+ - config/initializers/html_assets.rb
3227
3245
  - config/initializers/inflections.rb
3228
3246
  - config/initializers/kit_cache.rb
3229
3247
  - config/initializers/kit_indexes.rb