honey-cms 0.4.8 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +15 -0
  2. data/app/controllers/cms/base_controller.rb +2 -2
  3. data/app/views/cms/pages/show.html.slim +3 -0
  4. data/app/views/cms/root/{description.html.haml → description.html.slim} +6 -6
  5. data/app/views/cms/root/index.html.slim +1 -0
  6. data/app/views/layouts/{_flash.html.haml → _flash.html.slim} +5 -3
  7. data/app/views/layouts/cms.html.slim +42 -0
  8. data/lib/cms/configuration.rb +0 -1
  9. data/lib/cms/form_builder.rb +50 -21
  10. data/lib/generators/cms/admin_area_generator.rb +1 -1
  11. data/lib/generators/cms/content_types.rb +6 -2
  12. data/lib/generators/cms/init_generator.rb +15 -0
  13. data/lib/generators/cms/templates/cms_base_controller.rb +3 -3
  14. data/lib/generators/cms/templates/cms_helper.rb +14 -0
  15. data/lib/generators/cms/templates/type_controller.rb +6 -1
  16. data/lib/generators/cms/templates/type_model.rb +1 -1
  17. data/lib/generators/cms/templates/views/_fields.html.slim +16 -0
  18. data/lib/generators/cms/templates/views/edit.html.slim +5 -0
  19. data/lib/generators/cms/templates/views/index.html.slim +35 -0
  20. data/lib/generators/cms/templates/views/new.html.slim +5 -0
  21. data/lib/generators/cms/templates/views/show.html.slim +14 -0
  22. data/vendor/assets/javascripts/cms.js.coffee +1 -1
  23. data/vendor/assets/stylesheets/cms.css.scss +0 -1
  24. metadata +36 -27
  25. data/app/views/cms/pages/show.html.haml +0 -3
  26. data/app/views/cms/root/index.html.haml +0 -0
  27. data/app/views/layouts/cms.html.haml +0 -42
  28. data/lib/generators/cms/cms_generator.rb +0 -15
  29. data/lib/generators/cms/templates/views/_fields.html.haml +0 -16
  30. data/lib/generators/cms/templates/views/edit.html.haml +0 -4
  31. data/lib/generators/cms/templates/views/index.html.haml +0 -34
  32. data/lib/generators/cms/templates/views/new.html.haml +0 -4
  33. data/lib/generators/cms/templates/views/show.html.haml +0 -13
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MGYxNzM0MGEzNTM0NjExMzE4Y2NkNzViNWY5ZjdmYzNjZDNhNDk0ZQ==
5
+ data.tar.gz: !binary |-
6
+ MGI5MDI5YThhM2M5OGE5NTk4NTk2N2QwMTRmZTM1Yjg1NmQ2OTQ2ZA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ OGJmMDY0ZGIwMDUzYzEzNDI4NjhjNmVlNGQxNWI3ZTRmODg4MzFlMDk1YTc2
10
+ ZTYyMTVmODJlZDY2NGQ1ODE1MWJjODgwMDczMzQ4NzZmYzRlYTY1MWM3OWNi
11
+ NGE2MDI0MzY2Y2QzZmVhZGFlNDRlYzk4MGRlNTI5OGUyMDAyNmE=
12
+ data.tar.gz: !binary |-
13
+ MDNmNGUxMDBlYzg1MWIyMzViMDMyZjI5NWU4ZWJiM2EyZGY1YjliOTA4Nzhk
14
+ NzZmYmJhOGRlM2U1ZGFkYmZkZWZiNjNlMmRkZjkzMTc2OGZlZjg3ODM0NjBk
15
+ MWNlZDNhZTJhMzhlNmI2NmRjYjhmNzZlMjdjZGE0MTVhMDA4MTc=
@@ -27,7 +27,7 @@ class CMS::BaseController < ApplicationController
27
27
  end
28
28
 
29
29
  def create
30
- @record = subject.new(params[subject.model_name.element])
30
+ @record = subject.new(subject_params)
31
31
  @record.author = current_user if @record.respond_to?(:author=)
32
32
  @record.save
33
33
  set_element_variable
@@ -43,7 +43,7 @@ class CMS::BaseController < ApplicationController
43
43
  end
44
44
 
45
45
  def update
46
- @record.update_attributes params[subject.model_name.element]
46
+ @record.update_attributes subject_params
47
47
  respond_with @record
48
48
  end
49
49
 
@@ -0,0 +1,3 @@
1
+ .cms-page class: "cms-#{@page.name}-page"
2
+ = cms_page_area :"cms_#{@page.name}_page", @page.options do
3
+ h1= @page.name.capitalize
@@ -1,10 +1,10 @@
1
- %ul
1
+ ul
2
2
  - CMS::Configuration.types.each do |type|
3
- %li
3
+ li
4
4
  = type.name.underscore.humanize
5
- %ul
5
+ ul
6
6
  - type.attributes.each do |property|
7
- %li= property.name.humanize
8
- %ul
7
+ li= property.name.humanize
8
+ ul
9
9
  - type.options.each do |option|
10
- %li= option.humanize
10
+ li= option.humanize
@@ -0,0 +1 @@
1
+ .panel-body Please choose a content type from the left to get started.
@@ -1,13 +1,15 @@
1
1
  .alerts
2
2
  - if flash[:notice]
3
3
  .alert.alert-info
4
- <button type="button" class="close" data-dismiss="alert">×</button>
4
+ button.close type="button" data-dismiss="alert" ×
5
5
  = flash[:notice]
6
+
6
7
  - if flash[:success]
7
8
  .alert.alert-success
8
- <button type="button" class="close" data-dismiss="alert">×</button>
9
+ button.close type="button" data-dismiss="alert" ×
9
10
  = flash[:success]
11
+
10
12
  - if flash[:error] || flash[:alert]
11
13
  .alert.alert-error
12
- <button type="button" class="close" data-dismiss="alert">×</button>
14
+ button.close type="button" data-dismiss="alert" ×
13
15
  = flash[:error] || flash[:alert]
@@ -0,0 +1,42 @@
1
+ doctype html
2
+ html
3
+ head
4
+ = stylesheet_link_tag 'cms', media: 'all'
5
+ - if Rails.application.assets.find_asset('cms_additions.css').present?
6
+ = stylesheet_link_tag 'cms_additions', media: 'all'
7
+ = javascript_include_tag 'application'
8
+ - if Rails.application.assets.find_asset('cms_additions.js').present?
9
+ = javascript_include_tag 'cms_additions', media: 'all'
10
+ = stylesheet_link_tag 'codemirror'
11
+ = javascript_include_tag 'cms'
12
+ = csrf_meta_tags
13
+
14
+ body.cms class="#{if defined?(subject) then subject.name.underscore.dasherize end}"
15
+ .navbar.navbar-default.navbar-fixed-top.main-navigation
16
+ .container
17
+ .navbar-header
18
+ button.navbar-toggle type="button" data-toggle="collapse" data-target=".navbar-collapse"
19
+ span.sr-only Toggle navigation
20
+ span.icon-bar
21
+ span.icon-bar
22
+ span.icon-bar
23
+
24
+ .navbar-collapse.collapse
25
+ ul.nav.navbar-nav
26
+ li= link_to 'Home', root_path
27
+ ul.nav.navbar-nav.navbar-right
28
+ li= link_to 'Sign out', session_path, method: 'delete', class: 'session'
29
+
30
+ .container
31
+ = render partial: 'layouts/flash', locals: { flash: flash }
32
+
33
+ .row
34
+ .col-md-3
35
+ .list-group
36
+ .list-group-item: h5 CMS
37
+ - CMS::Configuration.types.each do |type|
38
+ a.list-group-item class="#{if defined?(subject) && type.subject == subject.name then 'active' end}" href=send("cms_#{type.model_name.collection}_path")
39
+ i.icon-chevron-right
40
+ = type.model_name.human.pluralize
41
+
42
+ .col-md-9: .panel.panel-default= yield
@@ -20,7 +20,6 @@ module CMS::Configuration
20
20
  def types
21
21
  if defined?(@types) then return @types end
22
22
 
23
- # raise data['content_types'].inspect
24
23
  @types = data['content_types'].map do |name, config|
25
24
  CMS::Type.new(name, config.delete('attributes'), config)
26
25
  end
@@ -1,34 +1,29 @@
1
1
  class CMS::FormBuilder < ActionView::Helpers::FormBuilder ; end
2
2
 
3
- ActionView::Base.field_error_proc = Proc.new do |html, instance|
4
- if html =~ /<label/
5
- html
6
- else
7
- message = instance.error_message.map{|m| "#{instance.method_name.humanize} #{m}"}.join(', ')
8
- "#{html}<div class=\"help-inline\">#{message}</div>".html_safe
9
- end
10
- end
11
-
12
3
  module CMS::FormBuilder::Fields
4
+ LABEL_WIDTH = 'col-lg-2'
5
+ FIELD_WIDTH = 'col-lg-4'
6
+
13
7
  def radio name, *args
14
8
  args = _apply_field_defaults(args)
15
9
  options = args.extract_options!
16
10
  values = args
17
11
  field_wrapper :radio, name do
18
12
  out = ''.html_safe
19
- out.concat label(name) if options[:label]
13
+ out.concat label(name, class: "#{LABEL_WIDTH} control-label") if options[:label]
20
14
 
21
- value_div = @template.content_tag(:span, class: 'values') do
15
+ value_div = @template.content_tag(:div, class: "#{FIELD_WIDTH} radio") do
22
16
  values.map do |value|
23
17
  @template.content_tag :span, class: 'value' do
24
18
  if value.is_a? Array
25
- radio_button(name, value[1]) + label(name, value[0], value: value[1])
19
+ radio_button(name, value[1].html_safe) + label(name, value[0].html_safe, value: value[1])
26
20
  else
27
21
  radio_button(name, value) + label(name, value, value: value)
28
22
  end
29
23
  end
30
24
  end.join("\n").html_safe
31
25
  end
26
+
32
27
  out.concat value_div
33
28
  end
34
29
  end
@@ -79,6 +74,10 @@ module CMS::FormBuilder::Fields
79
74
  field :string, *args
80
75
  end
81
76
 
77
+ def file *args
78
+ field :file, *args
79
+ end
80
+
82
81
  def search *args
83
82
  field :search, *args
84
83
  end
@@ -99,6 +98,10 @@ module CMS::FormBuilder::Fields
99
98
  field :hidden, *_apply_default_options(args, label: false, wrap_field: false)
100
99
  end
101
100
 
101
+ def choices attribute, choices, *args
102
+ field :choices, *_apply_default_options(args << attribute, choices: choices)
103
+ end
104
+
102
105
  # slider is weird enough that we will not use the default field helper.
103
106
  # instead, we will construct our own field that looks like a regular field.
104
107
  def slider name, *args
@@ -155,7 +158,7 @@ module CMS::FormBuilder::Fields
155
158
  end
156
159
 
157
160
  def field_wrapper type, name, options = {}
158
- classes = "field #{type} #{name.to_s.dasherize} control-group"
161
+ classes = "field #{type} #{name.to_s.dasherize} form-group"
159
162
  classes << options[:classes] if options[:classes]
160
163
  classes << ' error' if object.errors.include? name
161
164
  options.merge! class: classes
@@ -173,6 +176,8 @@ module CMS::FormBuilder::Fields
173
176
  out = ''.html_safe
174
177
 
175
178
  input_options = {}
179
+ input_args = []
180
+ input_classes = options[:class].try(:split, ' ') || []
176
181
 
177
182
  unless options[:autocomplete].nil?
178
183
  options.delete(:autocomplete)
@@ -180,32 +185,39 @@ module CMS::FormBuilder::Fields
180
185
  end
181
186
 
182
187
  unless options[:placeholder].nil?
183
- input_options[:placeholder] = options.delete(:placeholder)
188
+ input_options[:placeholder] = if (placeholder = options.delete(:placeholder)) == true then name.to_s.humanize else placeholder end
184
189
  end
185
190
 
186
191
  unless options[:hidden].nil?
187
- input_options[:class] = 'hidden' if options[:hidden] == true
192
+ input_classes << 'hidden' if options[:hidden] == true
188
193
  end
189
194
 
190
195
  unless options[:required].nil?
191
196
  input_options[:required] = 'required' if options[:required] == true
192
197
  end
193
198
 
194
- out.concat options[:prepend] if options[:prepend]
199
+ unless options[:choices].nil?
200
+ input_args << options[:choices]
201
+ end
195
202
 
203
+ out.concat options[:prepend] if options[:prepend]
196
204
 
197
- label_html = label(name, options[:label], class: 'control-label')
205
+ label_html = label(name, options[:label], class: "#{LABEL_WIDTH} control-label")
198
206
 
199
207
  out.concat label_html if options[:label] && options[:label_first]
200
208
 
201
209
  if options[:help_text]
202
210
  help_text = send("#{name}_help_text")
203
- help_html = "<a class=\"tipsy\" title=\"#{help_text}\" href=\"#\">learn more</a>".html_safe
211
+ help_html = %Q(<a class="tipsy" title="#{help_text}" href="#">learn more</a>).html_safe
204
212
  out.concat help_html
205
213
  end
206
214
 
207
- out.concat(@template.content_tag(:div, class: 'controls') do
208
- controls = send(_field_types(type), name, input_options)
215
+ input_classes << 'form-control'
216
+ input_options[:class] = input_classes.join(' ')
217
+
218
+ out.concat(@template.content_tag(:div, class: "#{FIELD_WIDTH} #{type}") do
219
+ merged_input_args = input_args << input_options
220
+ controls = send(_field_types(type), name, *merged_input_args)
209
221
  controls.concat @template.content_tag(:div, options[:help_block], class: 'help-block') if options[:help_block].present?
210
222
  controls
211
223
  end)
@@ -230,7 +242,11 @@ module CMS::FormBuilder::Fields
230
242
 
231
243
  # apply the default options for all fields.
232
244
  def _apply_field_defaults args
233
- _apply_default_options args, label: true, wrap_field: true, label_first: true
245
+ _apply_default_options args, field_options.reverse_merge(label: true, wrap_field: true, label_first: true)
246
+ end
247
+
248
+ def field_options
249
+ options[:fields] || {}
234
250
  end
235
251
 
236
252
  # single use method for parsing options provided by the +field+ helper
@@ -247,6 +263,8 @@ module CMS::FormBuilder::Fields
247
263
  case type
248
264
  when :string, :location
249
265
  :text_field
266
+ when :file
267
+ :file_field
250
268
  when :search
251
269
  :search_field
252
270
  when :text
@@ -261,6 +279,8 @@ module CMS::FormBuilder::Fields
261
279
  :radio_button
262
280
  when :boolean, :check
263
281
  :check_box
282
+ when :choices
283
+ :select
264
284
  end
265
285
  end
266
286
 
@@ -274,3 +294,12 @@ end
274
294
  class CMS::FormBuilder
275
295
  include CMS::FormBuilder::Fields
276
296
  end
297
+
298
+ ActionView::Base.field_error_proc = Proc.new do |html, instance|
299
+ if html =~ /<label/
300
+ html
301
+ else
302
+ message = instance.error_message.map{|m| "#{instance.instance_variable_get(:@method_name).humanize} #{m}"}.join(', ')
303
+ "#{html}<div class=\"help-inline\">#{message}</div>".html_safe
304
+ end
305
+ end
@@ -23,7 +23,7 @@ module CMS
23
23
  end
24
24
 
25
25
  %w(index new show edit _fields).each do |view|
26
- template "views/#{view}.html.haml", "app/views/cms/#{@name.collection}/#{view}.html.haml"
26
+ template "views/#{view}.html.slim", "app/views/cms/#{@name.collection}/#{view}.html.slim"
27
27
  end
28
28
  end
29
29
  end
@@ -1,4 +1,4 @@
1
- require 'rails/generators/active_record/migration'
1
+ require 'rails/generators/active_record'
2
2
  require 'generators/cms/base'
3
3
 
4
4
  module CMS
@@ -6,12 +6,16 @@ module CMS
6
6
 
7
7
  class ContentTypes < Base
8
8
  include Rails::Generators::Migration
9
- extend ActiveRecord::Generators::Migration
9
+
10
10
  class_option :except, type: :array, default: [],
11
11
  desc: 'skip certain types.'
12
12
 
13
13
  class_option :only, type: :string, default: false,
14
14
  desc: 'run a specific type generator.'
15
+
16
+ def self.next_migration_number(dirname)
17
+ ActiveRecord::Generators::Base.next_migration_number(dirname)
18
+ end
15
19
  end
16
20
 
17
21
  end
@@ -0,0 +1,15 @@
1
+ require 'generators/cms/base'
2
+
3
+ module CMS
4
+ module Generators
5
+
6
+ class Init < Base
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ def create_config
10
+ template 'cms_helper.rb', 'app/helpers/cms_helper.rb'
11
+ end
12
+ end
13
+
14
+ end
15
+ end
@@ -13,7 +13,7 @@ class CMS::BaseController < ApplicationController
13
13
  else
14
14
  subject.search(params[:search]).page(params[:page]).per(100)
15
15
  end
16
-
16
+
17
17
  set_collection_variable
18
18
  respond_with(@records)
19
19
  end
@@ -25,7 +25,7 @@ class CMS::BaseController < ApplicationController
25
25
  end
26
26
 
27
27
  def create
28
- @record = subject.create(params[subject.model_name.element])
28
+ @record = subject.create(subject_params)
29
29
  set_element_variable
30
30
  respond_with @record
31
31
  end
@@ -39,7 +39,7 @@ class CMS::BaseController < ApplicationController
39
39
  end
40
40
 
41
41
  def update
42
- @record.update_attributes params[subject.model_name.element]
42
+ @record.update_attributes subject_params
43
43
  respond_with @record
44
44
  end
45
45
 
@@ -0,0 +1,14 @@
1
+ module CMSHelper
2
+ def form_for *args, &block
3
+ options = args.extract_options!
4
+
5
+ layout = if options.delete(:layout) == 'vertical'
6
+ 'form-vertical'
7
+ else
8
+ 'form-horizontal'
9
+ end
10
+
11
+ args << options.reverse_merge(builder: CMS::FormBuilder, format: 'html', html: {class: layout})
12
+ super *args, &block
13
+ end
14
+ end
@@ -1,4 +1,4 @@
1
- class CMS::<%= @name.pluralize %>Controller < CMS::BaseController
1
+ class CMS::<%= @name.to_s.pluralize %>Controller < CMS::BaseController
2
2
  helper_method :subject
3
3
 
4
4
  protected
@@ -6,4 +6,9 @@ class CMS::<%= @name.pluralize %>Controller < CMS::BaseController
6
6
  def subject
7
7
  CMS::<%= @name %>
8
8
  end
9
+
10
+ def <%= @name.singular %>_params
11
+ params.require(:<%= @name.singular %>).permit(<%= @type.accessible_attributes.map {|a| ":#{a.field_name}" }.sort.join(', ') %>)
12
+ end
13
+ alias :subject_params :<%= @name.singular %>_params
9
14
  end
@@ -8,7 +8,7 @@ class CMS::<%= @name %> < ActiveRecord::Base
8
8
  has_many :<%= type.model_name.collection %>, class_name: 'CMS::<%= type %>'
9
9
  <% end -%>
10
10
  <% end -%>
11
- attr_accessible <%= @type.accessible_attributes.map {|a| ":#{a.field_name}" }.sort.join(', ') %>
11
+
12
12
  <% if @type.orderable? -%>
13
13
  include CMS::Orderable
14
14
  orderable(:<%= @type.order_attribute.name %><%= @type.order_options %>)
@@ -0,0 +1,16 @@
1
+ <% @type.attributes.each do |attribute| -%>
2
+ .form-group
3
+ = f.label :<%= attribute.field_name %>, class: 'col-md-2 control-label'
4
+ <% if attribute.orderable? -%>
5
+ .col-lg-10
6
+ = f.<%= attribute.form_type %> :<%= attribute.name %>, 1.upto(f.object.order_scope.count + 1).to_a, class: 'form-control'
7
+ <% elsif attribute.reference? -%>
8
+ .col-lg-10
9
+ = f.<%= attribute.form_type %> :<%= attribute.field_name %>, CMS::<%= attribute.reference_to %>.all.collect {|r| [ r.<%= attribute.options['reference_label'] %>, r.id ] }, class: 'form-control'
10
+ <% else -%>
11
+ .col-lg-10
12
+ = f.<%= attribute.form_type %> :<%= attribute.name %>, class: 'form-control'
13
+ <% end -%>
14
+ <% end -%>
15
+ .form-group
16
+ .col-lg-offset-2.col-lg-10= f.submit 'Save', class: 'btn btn-primary', :'data-disable-with' => 'Saving...'
@@ -0,0 +1,5 @@
1
+ .panel-heading: .panel-title: h5 Edit <%= @name.human.downcase %>
2
+
3
+ .panel-body
4
+ = form_for @<%= @name.element %>, url: cms_<%= @name.element %>_path(@<%= @name.element %>), html: {class: 'form-horizontal'} do |f|
5
+ = render partial: 'fields', locals: { f: f }
@@ -0,0 +1,35 @@
1
+ .panel-heading: .panel-title: h5 <%= @name.human.pluralize %>
2
+
3
+ .panel-body
4
+ = link_to 'New <%= @name.human.downcase %>', new_cms_<%= @name.element %>_path
5
+
6
+ table.table
7
+ thead
8
+ tr
9
+ th Id
10
+ <% @type.attributes.each do |attribute| -%>
11
+ th <%= attribute.name.humanize %>
12
+ <% end -%>
13
+ th
14
+
15
+ tbody
16
+ - @<%= @name.collection %>.each do |<%= @name.element %>|
17
+ tr
18
+ td= <%= @name.element %>.id
19
+ <% @type.attributes.each do |attribute| -%>
20
+ <% if attribute.reference? -%>
21
+ td
22
+ - if <%= @name.element %>.<%= attribute.name %>.present?
23
+ = link_to <%= @name.element %>.<%= attribute.name %>.<%= attribute.options['reference_label'] %>, cms_<%= attribute.reference_to.model_name.element %>_path(<%= @name.element %>.<%= attribute.name %>)
24
+ <% elsif attribute.format.file? -%>
25
+ td
26
+ img src: <%= @name.element %>.<%= attribute.name %>
27
+ <% else -%>
28
+ td= <%= @name.element %>.<%= attribute.name %>
29
+ <% end -%>
30
+ <% end -%>
31
+ td
32
+ span<>= link_to 'Edit', edit_cms_<%= @name.element %>_path(<%= @name.element %>)
33
+ span<>= link_to 'Destroy', cms_<%= @name.element %>_path(<%= @name.element %>), confirm: 'are you sure?', method: 'delete'
34
+
35
+ = paginate @<%= @name.collection %>
@@ -0,0 +1,5 @@
1
+ .panel-heading: .panel-title: h5 New <%= @name.human.downcase %>
2
+
3
+ .panel-body
4
+ = form_for @<%= @name.element %>, url: cms_<%= @name.collection %>_path, html: {class: 'form-horizontal'} do |f|
5
+ = render partial: 'fields', locals: { f: f }
@@ -0,0 +1,14 @@
1
+ .panel-heading: .panel-title: h5 Showing <%= @name.human.downcase %> #{@<%= @name.element %>.id}
2
+
3
+ .panel-body
4
+ dl
5
+ <% @type.attributes.each do |attribute| -%>
6
+ dt <%= attribute.name.humanize %>
7
+ <% if attribute.reference? -%>
8
+ dd= @<%= @name.element %>.<%= attribute.name %>.try(:<%= attribute.options['reference_label'] %>)
9
+ <% elsif attribute.format.text? -%>
10
+ dd= markdown @<%= @name.element %>.<%= attribute.name %>
11
+ <% else -%>
12
+ dd= @<%= @name.element %>.<%= attribute.name %>
13
+ <% end -%>
14
+ <% end -%>
@@ -46,7 +46,7 @@ class window.MarkdownEditor extends HtmlEditor
46
46
  @$('[role=editor] .content').initializeEpicEditor()
47
47
  @$('[role=editor]').hide().css 'visibility', 'visible'
48
48
 
49
- jQuery ($) ->
49
+ jQuery.turboLoad = (fn) ->
50
50
  console.log $('[role=html-editor]')
51
51
  new HtmlEditor {el} for el in $('[role=html-editor]')
52
52
  new MarkdownEditor {el} for el in $('[role=markdown-editor]')
@@ -3,7 +3,6 @@
3
3
  */
4
4
 
5
5
  @import 'bootstrap';
6
- @import 'bootstrap-responsive';
7
6
 
8
7
  @media (max-width: 979px) {
9
8
  body {
metadata CHANGED
@@ -1,49 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honey-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
5
- prerelease:
4
+ version: 0.5.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Quinn Shanahan
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-21 00:00:00.000000000 Z
11
+ date: 2013-10-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: redcarpet
16
- requirement: &70114678823800 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70114678823800
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: kaminari
27
- requirement: &70114678821160 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - ! '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *70114678821160
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: carrierwave
38
- requirement: &70114687528340 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
45
  - - ! '>='
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :runtime
45
49
  prerelease: false
46
- version_requirements: *70114687528340
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  description: Some CMS functionality
48
56
  email: quinn@tastehoneyco.com
49
57
  executables: []
@@ -85,54 +93,55 @@ files:
85
93
  - lib/generators/cms/admin_area_generator.rb
86
94
  - lib/generators/cms/admin_generator.rb
87
95
  - lib/generators/cms/base.rb
88
- - lib/generators/cms/cms_generator.rb
89
96
  - lib/generators/cms/config_generator.rb
90
97
  - lib/generators/cms/content_types.rb
98
+ - lib/generators/cms/init_generator.rb
91
99
  - lib/generators/cms/migration_generator.rb
92
100
  - lib/generators/cms/pages_generator.rb
93
101
  - lib/generators/cms/templates/cms.yml
94
102
  - lib/generators/cms/templates/cms_base_controller.rb
103
+ - lib/generators/cms/templates/cms_helper.rb
95
104
  - lib/generators/cms/templates/cms_model.rb
96
105
  - lib/generators/cms/templates/migration.rb
97
106
  - lib/generators/cms/templates/type_controller.rb
98
107
  - lib/generators/cms/templates/type_model.rb
99
- - lib/generators/cms/templates/views/_fields.html.haml
100
- - lib/generators/cms/templates/views/edit.html.haml
101
- - lib/generators/cms/templates/views/index.html.haml
102
- - lib/generators/cms/templates/views/new.html.haml
103
- - lib/generators/cms/templates/views/show.html.haml
108
+ - lib/generators/cms/templates/views/_fields.html.slim
109
+ - lib/generators/cms/templates/views/edit.html.slim
110
+ - lib/generators/cms/templates/views/index.html.slim
111
+ - lib/generators/cms/templates/views/new.html.slim
112
+ - lib/generators/cms/templates/views/show.html.slim
104
113
  - lib/generators/cms/USAGE
105
114
  - lib/honey-cms.rb
106
115
  - app/controllers/cms/base_controller.rb
107
116
  - app/controllers/cms/pages_controller.rb
108
117
  - app/controllers/cms/root_controller.rb
109
- - app/views/cms/pages/show.html.haml
110
- - app/views/cms/root/description.html.haml
111
- - app/views/cms/root/index.html.haml
112
- - app/views/layouts/_flash.html.haml
113
- - app/views/layouts/cms.html.haml
118
+ - app/views/cms/pages/show.html.slim
119
+ - app/views/cms/root/description.html.slim
120
+ - app/views/cms/root/index.html.slim
121
+ - app/views/layouts/_flash.html.slim
122
+ - app/views/layouts/cms.html.slim
114
123
  homepage: https://github.com/honeyco/honey-cms
115
124
  licenses: []
125
+ metadata: {}
116
126
  post_install_message:
117
127
  rdoc_options: []
118
128
  require_paths:
119
129
  - lib
120
130
  required_ruby_version: !ruby/object:Gem::Requirement
121
- none: false
122
131
  requirements:
123
132
  - - ! '>='
124
133
  - !ruby/object:Gem::Version
125
134
  version: '0'
126
135
  required_rubygems_version: !ruby/object:Gem::Requirement
127
- none: false
128
136
  requirements:
129
137
  - - ! '>='
130
138
  - !ruby/object:Gem::Version
131
139
  version: '0'
132
140
  requirements: []
133
141
  rubyforge_project:
134
- rubygems_version: 1.8.11
142
+ rubygems_version: 2.0.7
135
143
  signing_key:
136
- specification_version: 3
144
+ specification_version: 4
137
145
  summary: CMS
138
146
  test_files: []
147
+ has_rdoc:
@@ -1,3 +0,0 @@
1
- .cms-page{class: "cms-#{@page.name}-page"}
2
- = cms_page_area :"cms_#{@page.name}_page", @page.options do
3
- %h1= @page.name.capitalize
File without changes
@@ -1,42 +0,0 @@
1
- !!!
2
- %html
3
- %head
4
- = stylesheet_link_tag 'cms', media: 'all'
5
- - if Rails.application.assets.find_asset('cms_additions.css').present?
6
- = stylesheet_link_tag 'cms_additions', media: 'all'
7
- = javascript_include_tag 'application'
8
- - if Rails.application.assets.find_asset('cms_additions.js').present?
9
- = javascript_include_tag 'cms_additions', media: 'all'
10
- = stylesheet_link_tag 'codemirror'
11
- = javascript_include_tag 'cms'
12
- = csrf_meta_tags
13
-
14
- %body.cms{class: "#{if defined?(subject) then subject.name.underscore.dasherize end}"}
15
- .navbar.navbar-fixed-top.main-navigation
16
- .navbar-inner
17
- .container
18
- %button.btn.btn-navbar{type: 'button', :'data-toggle' => 'collapse', :'data-target' => '.nav-collapse'}
19
- %span.icon-bar
20
- %span.icon-bar
21
- %span.icon-bar
22
-
23
- .nav-collapse.collapse
24
- %ul.nav
25
- %li= link_to 'Home', root_path
26
- %ul.nav.pull-right
27
- %li= link_to 'Sign out', session_path, method: 'delete', class: 'session'
28
-
29
- .container
30
- = render partial: 'layouts/flash', locals: { flash: flash }
31
-
32
- .row
33
- .span3
34
- %h5 CMS
35
- %ul.nav.nav-list
36
- - CMS::Configuration.types.each do |type|
37
- %li{class: "#{if defined?(subject) && type.subject == subject.name then 'active' end}"}
38
- = link_to send("cms_#{type.model_name.collection}_path") do
39
- %i.icon-chevron-right
40
- = type.model_name.human.pluralize
41
-
42
- .span9= yield
@@ -1,15 +0,0 @@
1
- require 'cms/generators/base'
2
-
3
- module CMS
4
- module Generators
5
-
6
- class PagesController < Base
7
- def create_pages
8
- CMS::Configuration.pages.each do |page|
9
- template
10
- end
11
- end
12
- end
13
-
14
- end
15
- end
@@ -1,16 +0,0 @@
1
- <% @type.attributes.each do |attribute| -%>
2
- .control-group
3
- = f.label :<%= attribute.field_name %>, class: 'control-label'
4
- <% if attribute.orderable? -%>
5
- .controls
6
- = f.<%= attribute.form_type %> :<%= attribute.name %>, 1.upto(f.object.order_scope.count + 1).to_a
7
- <% elsif attribute.reference? -%>
8
- .controls
9
- = f.<%= attribute.form_type %> :<%= attribute.field_name %>, CMS::<%= attribute.reference_to %>.all.collect {|r| [ r.<%= attribute.options['reference_label'] %>, r.id ] }
10
- <% else -%>
11
- .controls
12
- = f.<%= attribute.form_type %> :<%= attribute.name %>
13
- <% end -%>
14
- <% end -%>
15
- .form-actions
16
- = f.submit 'Save', class: 'btn btn-primary', :'data-disable-with' => 'Saving...'
@@ -1,4 +0,0 @@
1
- %h2 Edit <%= @name.human.downcase %>
2
-
3
- = form_for @<%= @name.element %>, url: cms_<%= @name.element %>_path(@<%= @name.element %>), html: {class: 'form-horizontal'} do |f|
4
- = render partial: 'fields', locals: { f: f }
@@ -1,34 +0,0 @@
1
- %h2 <%= @name.human.pluralize %>
2
-
3
- = link_to 'New <%= @name.human.downcase %>', new_cms_<%= @name.element %>_path
4
-
5
- %table.table
6
- %thead
7
- %tr
8
- %th Id
9
- <% @type.attributes.each do |attribute| -%>
10
- %th <%= attribute.name.humanize %>
11
- <% end -%>
12
- %th
13
-
14
- %tbody
15
- - @<%= @name.collection %>.each do |<%= @name.element %>|
16
- %tr
17
- %td= <%= @name.element %>.id
18
- <% @type.attributes.each do |attribute| -%>
19
- <% if attribute.reference? -%>
20
- %td
21
- - if <%= @name.element %>.<%= attribute.name %>.present?
22
- = link_to <%= @name.element %>.<%= attribute.name %>.<%= attribute.options['reference_label'] %>, cms_<%= attribute.reference_to.model_name.element %>_path(<%= @name.element %>.<%= attribute.name %>)
23
- <% elsif attribute.format.file? -%>
24
- %td
25
- %img{src: <%= @name.element %>.<%= attribute.name %>}
26
- <% else -%>
27
- %td= <%= @name.element %>.<%= attribute.name %>
28
- <% end -%>
29
- <% end -%>
30
- %td
31
- = link_to 'Edit', edit_cms_<%= @name.element %>_path(<%= @name.element %>)
32
- = link_to 'Destroy', cms_<%= @name.element %>_path(<%= @name.element %>), confirm: 'are you sure?', method: 'delete'
33
-
34
- = paginate @<%= @name.collection %>
@@ -1,4 +0,0 @@
1
- %h2 New <%= @name.human.downcase %>
2
-
3
- = form_for @<%= @name.element %>, url: cms_<%= @name.collection %>_path, html: {class: 'form-horizontal'} do |f|
4
- = render partial: 'fields', locals: { f: f }
@@ -1,13 +0,0 @@
1
- %h2== Showing <%= @name.human.downcase %> ##{@<%= @name.element %>.id}
2
-
3
- %dl
4
- <% @type.attributes.each do |attribute| -%>
5
- %dt <%= attribute.name.humanize %>
6
- <% if attribute.reference? -%>
7
- %dd= @<%= @name.element %>.<%= attribute.name %>.try(:<%= attribute.options['reference_label'] %>)
8
- <% elsif attribute.format.text? -%>
9
- %dd= markdown @<%= @name.element %>.<%= attribute.name %>
10
- <% else -%>
11
- %dd= @<%= @name.element %>.<%= attribute.name %>
12
- <% end -%>
13
- <% end -%>