noodall-ui 0.3.20 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. data/Gemfile +8 -3
  2. data/Rakefile +2 -2
  3. data/app/controllers/noodall/admin/nodes_controller.rb +31 -14
  4. data/app/controllers/noodall/admin/versions_controller.rb +13 -0
  5. data/app/controllers/noodall/nodes_controller.rb +11 -1
  6. data/app/views/noodall/admin/nodes/index.html.erb +28 -13
  7. data/app/views/noodall/admin/nodes/show.html.erb +34 -23
  8. data/app/views/noodall/admin/versions/index.html.erb +17 -0
  9. data/config/application.rb +1 -1
  10. data/config/environments/development.rb +2 -5
  11. data/config/environments/test.rb +29 -0
  12. data/demo/initializers/zdragonfly.rb +5 -0
  13. data/demo/models/page_a.rb +1 -1
  14. data/features/choose_node_title.feature +24 -0
  15. data/features/node_filtering.feature +20 -0
  16. data/features/publish_content.feature +1 -1
  17. data/features/save_draft.feature +34 -0
  18. data/features/step_definitions/choose_node_title_steps.rb +7 -0
  19. data/features/step_definitions/cms_node_steps.rb +1 -1
  20. data/features/step_definitions/content_steps.rb +8 -0
  21. data/features/step_definitions/draft_steps.rb +39 -0
  22. data/features/step_definitions/node_steps.rb +4 -1
  23. data/features/step_definitions/pubish_content_steps.rb +3 -3
  24. data/features/step_definitions/web_steps.rb +4 -0
  25. data/features/support/env.rb +3 -1
  26. data/features/support/paths.rb +6 -3
  27. data/lib/noodall/routes.rb +4 -1
  28. data/lib/noodall/ui/version.rb +1 -1
  29. data/noodall-ui.gemspec +2 -2
  30. data/public/images/admin/{draft.png → hidden.png} +0 -0
  31. data/public/images/admin/hide.gif +0 -0
  32. data/public/images/admin/versions.gif +0 -0
  33. data/public/javascripts/admin/application.js +2 -0
  34. data/public/stylesheets/admin/forms.css +32 -2
  35. data/public/stylesheets/admin/layout.css +41 -9
  36. data/public/stylesheets/admin/skin.css +32 -23
  37. data/public/stylesheets/admin/typography.css +3 -0
  38. metadata +112 -76
  39. data/demo/initializers/dragonfly.rb +0 -1
  40. data/lib/noodall/dragonfly.rb +0 -23
  41. data/public/javascripts/tiny_mce/plugins/addvideo/dialog.htm +0 -19
  42. data/public/javascripts/tiny_mce/plugins/addvideo/js/dialog.js +0 -34
  43. data/public/javascripts/tiny_mce/plugins/example/dialog.htm +0 -22
  44. data/public/javascripts/tiny_mce/plugins/example/editor_plugin.js +0 -1
  45. data/public/javascripts/tiny_mce/plugins/example/editor_plugin_src.js +0 -84
  46. data/public/javascripts/tiny_mce/plugins/example/img/example.gif +0 -0
  47. data/public/javascripts/tiny_mce/plugins/example/js/dialog.js +0 -19
  48. data/public/javascripts/tiny_mce/plugins/example/langs/en.js +0 -3
  49. data/public/javascripts/tiny_mce/plugins/example/langs/en_dlg.js +0 -3
  50. data/public/stylesheets/sass/forms.scss +0 -7
  51. data/public/stylesheets/sass/ie.scss +0 -12
  52. data/public/stylesheets/sass/ie8.scss +0 -8
  53. data/public/stylesheets/sass/layout.scss +0 -45
  54. data/public/stylesheets/sass/skin.scss +0 -35
  55. data/public/stylesheets/sass/typography.scss +0 -162
data/Gemfile CHANGED
@@ -3,10 +3,13 @@ source 'http://gems.github.com'
3
3
 
4
4
  gemspec
5
5
 
6
+ #temp
7
+ gem 'noodall-core', '~> 0.7.3'
8
+
6
9
  # Required for running as demo rails app
7
10
  gem 'rails', '~> 3.0.1'
8
11
  gem 'rmagick', :require => 'RMagick'
9
- gem 'dragonfly', '~> 0.7.6'
12
+ gem 'dragonfly', '~> 0.9.4'
10
13
 
11
14
  # Bundle gems for the local environment. Make sure to
12
15
  # put test-only gems in this group so their generators
@@ -16,11 +19,13 @@ group :development, :test do
16
19
  gem 'database_cleaner'
17
20
  gem 'cucumber-rails'
18
21
  gem 'cucumber'
19
- gem 'rspec-rails', "~> 2.0.0.beta.22"
22
+ gem 'rspec-rails', "~> 2.0.0"
20
23
  gem 'spork'
21
24
  gem 'launchy' # So you can do Then show me the page
22
25
  gem 'jeweler', '~> 1.4.0'
23
26
  gem 'factory_girl_rails'
24
27
  gem "faker", "~> 0.3.1"
25
- gem "haml"
28
+ gem "SystemTimer", ">= 1.2.0"
29
+ gem "bson_ext", "~> 1.3.0"
30
+ gem "ruby-debug"
26
31
  end
data/Rakefile CHANGED
@@ -12,6 +12,6 @@ end
12
12
 
13
13
  task :default => :spec
14
14
 
15
- #require File.expand_path('../config/application', __FILE__)
15
+ require File.expand_path('../config/application', __FILE__)
16
16
 
17
- #Noodall::Application.load_tasks
17
+ Noodall::Application.load_tasks
@@ -7,12 +7,16 @@ module Noodall
7
7
  sortable_attributes :position, :admin_title, :title, :type, :updated_at
8
8
 
9
9
  def index
10
+
10
11
  if params[:node_id].nil?
11
- @nodes = Node.roots.paginate(:per_page => 20, :page => params[:page], :order => sort_order(:default => "ascending") )
12
+ nodes = Node.roots
12
13
  else
13
14
  @parent = Node.find(params[:node_id])
14
- @nodes = @parent.children.paginate(:per_page => 20, :page => params[:page], :order => sort_order(:default => "ascending") )
15
+ nodes = @parent.children
15
16
  end
17
+
18
+ per_page = 15
19
+ @nodes = nodes.where( :title => /#{params[:f]}/i ).paginate(:per_page => (params[:limit] || per_page), :page => params[:page], :order => sort_order(:default => "ascending") )
16
20
 
17
21
  respond_to do |format|
18
22
  format.html # index.html.erb
@@ -41,6 +45,14 @@ module Noodall
41
45
  enforce_update_permission(@node)
42
46
  enforce_publish_permission(@node) if @node.published?
43
47
 
48
+ if !params[:version_number].blank?
49
+ @node.rollback(params[:version_number].to_i)
50
+ flash[:alert] = "You are viewing draft version '#{@node.version_number}' of this page"
51
+ elsif @node.has_draft?
52
+ @node.rollback(:latest)
53
+ flash[:alert] = "You are editing a draft version of this page"
54
+ end
55
+
44
56
  respond_to do |format|
45
57
  format.html
46
58
  format.xml { render :xml => @node }
@@ -91,20 +103,25 @@ module Noodall
91
103
  # Set user stamp
92
104
  @node.updater = current_user
93
105
 
94
- respond_to do |format|
106
+ if params[:draft].blank?
95
107
  if @node.update_attributes(params[:node])
96
- flash[:notice] = "#{@node.class.name.titleize} '#{@node.title}' was successfully updated."
97
- format.html {
98
- if @node.parent.nil?
99
- redirect_to noodall_admin_nodes_path
100
- else
101
- redirect_to noodall_admin_node_nodes_path(@node.parent.id)
102
- end
103
- }
104
- format.xml { head :ok }
108
+ flash[:notice] = "#{@node.class.name.titleize} '#{@node.title}' was successfully published."
109
+ if @node.parent.nil?
110
+ redirect_to noodall_admin_nodes_path
111
+ else
112
+ redirect_to noodall_admin_node_nodes_path(@node.parent.id)
113
+ end
105
114
  else
106
- format.html { render :action => "show" }
107
- format.xml { render :xml => @node.errors, :status => :unprocessable_entity }
115
+ render :action => "show"
116
+ end
117
+ else
118
+ @node.attributes = params[:node]
119
+ @node.save_version(current_user.id)
120
+ flash[:notice] = "#{@node.class.name.titleize} '#{@node.title}' was successfully saved as version #{@node.version_number} (draft)."
121
+ if @node.parent.nil?
122
+ redirect_to noodall_admin_nodes_path
123
+ else
124
+ redirect_to noodall_admin_node_nodes_path(@node.parent.id)
108
125
  end
109
126
  end
110
127
  end
@@ -0,0 +1,13 @@
1
+ module Noodall
2
+ module Admin
3
+ class VersionsController < BaseController
4
+
5
+ def index
6
+ @node = Node.find(params[:node_id])
7
+ @versions = @node.all_versions.order('pos DESC').paginate(:page => params[:page], :per_page => 10)
8
+ render :index, :layout => false
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -12,7 +12,7 @@ module Noodall
12
12
  #Check view permissions
13
13
  enforce_view_permission(@node)
14
14
 
15
- @page_title = @node.title
15
+ @page_title = @node.browser_title.blank? ? @node.title : @node.browser_title
16
16
  @page_description = @node.description
17
17
  @page_keywords = @node.keywords
18
18
 
@@ -24,6 +24,16 @@ module Noodall
24
24
  end
25
25
  end
26
26
 
27
+ def version
28
+ @node = Node.find!(params[:node_id])
29
+ version = @node.all_versions.find!(params[:id])
30
+ @node.rollback(version.pos)
31
+ @page_title = @node.browser_title.blank? ? @node.title : @node.browser_title
32
+ @page_description = @node.description
33
+ @page_keywords = @node.keywords
34
+ render "nodes/#{@node.class.name.underscore}"
35
+ end
36
+
27
37
  def sitemap
28
38
  if stale?(:last_modified => GlobalUpdateTime::Stamp.read, :public => true)
29
39
  @page_title = 'Sitemap'
@@ -19,21 +19,35 @@
19
19
  <% end %>
20
20
 
21
21
  </ul>
22
- <%= will_paginate(@nodes, :previous_label => 'Previous', :next_label => 'Next') %>
22
+
23
23
  <div id="content-table">
24
+
25
+ <div id="form-filter">
26
+ <%= form_tag '', :method => :get, :id => 'filter' do %>
27
+ <%= label_tag :f, 'Filter by Title' %>
28
+ <%= text_field_tag :f %>
29
+ <%= submit_tag "Filter" %>
30
+ <% end %>
31
+
32
+ <% if params[:f] %>
33
+ <%= link_to "reset", url_for(:only_path => false, :f => nil), :class => 'button' %>
34
+ <% end %>
35
+ </div>
36
+
37
+ <%= will_paginate(@nodes) %>
24
38
  <table border="0" cellspacing="0" cellpadding="0" class="content">
25
39
  <thead>
26
40
  <tr>
27
41
  <%= sortable_table_header :name => "Title", :sort => "admin_title", :class => 'sort' %>
28
42
  <%= sortable_table_header :name => "Type", :sort => "_type", :class => 'sort' %>
29
-
43
+
30
44
  <%# Change 'position' header if we are sorting by position %>
31
45
  <% if(params[:sort] && params[:sort] != "position" || params[:order] == "descending") %>
32
46
  <%= sortable_table_header :name => "Position", :sort => "position", :class => 'sort' %>
33
47
  <% else %>
34
48
  <%= sortable_table_header :name => "Position", :sort => "position", :class => 'sort', :colspan => 2 %>
35
49
  <% end %>
36
-
50
+
37
51
  <th width="120">Sub Section</th>
38
52
  <%= sortable_table_header :name => "Updated", :sort => "updated_at", :class => 'sort' %>
39
53
  <th width="45">Show</th>
@@ -43,20 +57,20 @@
43
57
  </thead>
44
58
  <tbody>
45
59
  <% @nodes.each do |node| %>
46
- <tr id="node-<%= node.id %>" class="<%=cycle('odd', 'even')%>">
47
- <td class="edit"><%= link_to h(node.admin_title), noodall_admin_node_path(node), :class => 'edit', :title => "Edit #{node.title}" %></td>
60
+ <tr id="node-<%= node.id %>" class="node <%=cycle('odd', 'even')%>">
61
+ <td class="edit"><%= link_to "#{ node.admin_title } #{ '(draft)' if node.has_draft? }", noodall_admin_node_path(node), :class => 'edit', :title => "Edit #{node.title}" %></td>
48
62
  <td><%= node.class.name.titleize %></td>
49
-
63
+
50
64
  <%# Change 'position' content if we are sorting by position %>
51
65
  <% if(params[:sort] && params[:sort] != "position" || params[:order] == "descending") %>
52
66
  <td width="55"><%= node.position %></td>
53
67
  <% else %>
54
-
68
+
55
69
  <td width="25"><%= link_to 'up', move_up_noodall_admin_node_path(node), { :class => "page_up", :title => 'Move this content higher in the navigation' } unless node.first? %></td>
56
70
  <td width="30" class="down"><%= link_to 'down', move_down_noodall_admin_node_path(node), { :class => 'page_down', :title => 'Move this content lower in the navigation' } unless node.last? %></td>
57
71
  <% end %>
58
-
59
-
72
+
73
+
60
74
  <td class="child">
61
75
  <% unless node.class.template_classes.blank? -%>
62
76
  <%= link_to pluralize(node.children.size, "Child"), noodall_admin_node_nodes_path(node), :title => "View content under #{h(node.title)}", :class => 'child-no' %>
@@ -65,7 +79,7 @@
65
79
  </td>
66
80
  <td class="date" title="by <%= node.updater.full_name if node.updater %>"><%=h node.updated_at.to_formatted_s(:short_ordinal) %></td>
67
81
  <td class=""><%= link_to 'Show', node_path(node), :class => 'show', :title => 'View this content' if node.published? %></td>
68
- <td class="date" title="<%= node.published? ? 'Published ':'Draft' %><%= node.published_at.to_formatted_s(:short_ordinal) unless node.published_at.nil? %><%= " - #{node.published_to.to_formatted_s(:short_ordinal)}" unless node.published_to.nil? %>"><%= (node.published? ? '<span class="check">Published</span>' : '<span class="draft">Draft</span>').html_safe %></td>
82
+ <td class="date" title="<%= node.published? ? 'Published ':'Hidden' %><%= node.published_at.to_formatted_s(:short_ordinal) unless node.published_at.nil? %><%= " - #{node.published_to.to_formatted_s(:short_ordinal)}" unless node.published_to.nil? %>"><%= (node.published? ? '<span class="check">Published</span>' : '<span class="hidden">Hidden</span>').html_safe %></td>
69
83
  <td><%= link_to 'Delete', noodall_admin_node_path(node), :confirm => 'Are you sure?', :method => :delete, :class => 'delete', :title => 'Delete this content' unless node.in_site_map? %></td>
70
84
  </tr>
71
85
  <% end %>
@@ -74,14 +88,14 @@
74
88
  <tr>
75
89
  <%= sortable_table_header :name => "Title", :sort => "admin_title", :class => 'sort' %>
76
90
  <%= sortable_table_header :name => "Type", :sort => "_type", :class => 'sort' %>
77
-
91
+
78
92
  <%# Change 'position' header if we are sorting by position %>
79
93
  <% if(params[:sort] && params[:sort] != "position" || params[:order] == "descending") %>
80
94
  <%= sortable_table_header :name => "Position", :sort => "position", :class => 'sort' %>
81
95
  <% else %>
82
96
  <%= sortable_table_header :name => "Position", :sort => "position", :class => 'sort', :colspan => 2 %>
83
97
  <% end %>
84
-
98
+
85
99
  <th width="120">Sub Section</th>
86
100
  <%= sortable_table_header :name => "Updated", :sort => "updated_at", :class => 'sort' %>
87
101
  <th width="45">Show</th>
@@ -90,5 +104,6 @@
90
104
  </tr>
91
105
  </tfoot>
92
106
  </table>
93
- </div>
94
107
  <%= will_paginate(@nodes, :previous_label => 'Previous', :next_label => 'Next') %>
108
+
109
+ </div>
@@ -39,7 +39,9 @@
39
39
  <div class="fixed-form">
40
40
  <div id="buttons">
41
41
  <%= f.submit 'Publish', :class => 'publish', :name => 'node[publish]' if can_publish?(@node) %>
42
- <%= f.submit 'Draft', :name => 'node[hide]', :class => 'draft' %>
42
+ <%= f.submit 'Draft', :name => "draft", :class => 'draft' %>
43
+ <%= link_to 'Versions', noodall_admin_node_versions_path(@node), :id => "versions-button" %>
44
+ <%= f.submit 'Hide', :name => 'node[hide]', :id => 'hide' %>
43
45
  <%= link_to 'Cancel', @node.root? ? noodall_admin_nodes_path : noodall_admin_node_nodes_path(@node.parent), :class => 'cancel' %>
44
46
  </div>
45
47
 
@@ -49,7 +51,7 @@
49
51
  <fieldset>
50
52
  <legend class="advanced">Advanced</legend>
51
53
  <div id="advanced">
52
-
54
+
53
55
  <div class="published-section">
54
56
  <p class="published">
55
57
  <%= f.label :published_at, "Publish at" %><br/>
@@ -103,27 +105,36 @@
103
105
  </div>
104
106
  <% end -%>
105
107
 
106
-
107
-
108
-
109
- <div class="position-section">
110
- <% unless @node.in_site_map? %>
111
- <p>
112
- <span class="node-mover">Parent Content</span>
113
- <span class="input-wrap" id="parent-title">
114
- <%= @node.root? ? "Root" : @node.parent.title %>
115
- <a href="#" class="edit-item">Edit</a>
116
- </span>
117
- <%= f.hidden_field :parent, :value => @node.parent_id %>
118
- <%= hidden_field_tag :parent_types, @node.class.parent_classes.join(','), :disabled => true %>
119
- </p>
120
- <p>
121
- <span class="tooltip" title="Enter a custom url or leave it as the default value shown.">&nbsp;</span>
122
- <%= f.label :permalink, 'Page Url' %><br/>
123
- <span class="input-wrap"><%= f.text_field :permalink %></span>
124
- </p>
125
- <% end %>
126
- </div>
108
+
109
+
110
+
111
+ <div class="position-section">
112
+ <% unless @node.in_site_map? %>
113
+ <p>
114
+ <span class="node-mover">Parent Content</span>
115
+ <span class="input-wrap" id="parent-title">
116
+ <%= @node.root? ? "Root" : @node.parent.title %>
117
+ <a href="#" class="edit-item">Edit</a>
118
+ </span>
119
+ <%= f.hidden_field :parent, :value => @node.parent_id %>
120
+ <%= hidden_field_tag :parent_types, @node.class.parent_classes.join(','), :disabled => true %>
121
+ </p>
122
+
123
+ <!-- PAGE URL -->
124
+ <p>
125
+ <span class="tooltip" title="Enter a custom url or leave it as the default value shown."> &nbsp; </span>
126
+ <%= f.label :permalink, 'Page Url' %><br/>
127
+ <span class="input-wrap"><%= f.text_field :permalink %></span>
128
+ </p>
129
+
130
+ <!-- BROWSER TITLE -->
131
+ <p>
132
+ <span class="tooltip" title="This is normally the title shown at the very top of your browser window."> &nbsp; </span>
133
+ <%= f.label :browser_title, 'Browser Title' %><br/>
134
+ <span class="input-wrap"><%= f.text_field :browser_title %></span>
135
+ </p>
136
+ <% end %>
137
+ </div>
127
138
  </div>
128
139
  </fieldset>
129
140
  </div>
@@ -0,0 +1,17 @@
1
+ <table id="versions-list" class="content">
2
+ <thead>
3
+ <th> Version </th>
4
+ <th> Date </th>
5
+ <th colspan="2"> Actions </th>
6
+ </thead>
7
+ <tbody>
8
+ <% for version in @versions %>
9
+ <tr class="<%= "active" if version.pos == @node.version_number %>">
10
+ <td> Version <%= version.pos %> </td>
11
+ <td> <%= l version.date %> </td>
12
+ <td> <%= link_to "View", noodall_version_path(@node, version) %> </td>
13
+ <td> <%= link_to "Use", noodall_admin_node_path(@node, :version_number => version.pos) %> </td>
14
+ </tr>
15
+ <% end %>
16
+ </tbody>
17
+ </table>
@@ -26,6 +26,6 @@ module Noodall
26
26
  paths.config.routes 'demo/routes.rb'
27
27
  paths.config.initializers << "demo/initializers"
28
28
 
29
- config.middleware.insert_after 'Rack::Lock', 'Dragonfly::Middleware', :noodall_assets, '/media'
29
+ config.middleware.insert 0, 'Dragonfly::Middleware', :noodall_assets
30
30
  end
31
31
  end
@@ -4,7 +4,7 @@ Noodall::Application.configure do
4
4
  # In the development environment your application's code is reloaded on
5
5
  # every request. This slows down response time but is perfect for development
6
6
  # since you don't have to restart the webserver when you make code changes.
7
- config.cache_classes = true
7
+ config.cache_classes = false
8
8
 
9
9
  # Log error messages when you accidentally call methods on nil.
10
10
  config.whiny_nils = true
@@ -22,9 +22,6 @@ Noodall::Application.configure do
22
22
 
23
23
  # Only use best-standards-support built into browsers
24
24
  config.action_dispatch.best_standards_support = :builtin
25
-
26
- # Set up SASS for development with firebug plugin
27
- Sass::Plugin.options[:debug_info] = true
28
-
25
+
29
26
  end
30
27
 
@@ -33,3 +33,32 @@ Noodall::Application.configure do
33
33
  # Print deprecation notices to the stderr
34
34
  config.active_support.deprecation = :stderr
35
35
  end
36
+
37
+ require 'dragonfly'
38
+ require 'stringio'
39
+ require 'tempfile'
40
+ module Dragonfly
41
+ class TempObject
42
+ private
43
+ def initialize_from_object!(obj)
44
+ case obj
45
+ when TempObject
46
+ @initialized_data = obj.initialized_data
47
+ @initialized_tempfile = copy_to_tempfile(obj.initialized_tempfile.path) if obj.initialized_tempfile
48
+ @initialized_file = obj.initialized_file
49
+ when String
50
+ @initialized_data = obj
51
+ when Tempfile
52
+ @initialized_tempfile = obj
53
+ when File
54
+ @initialized_file = obj
55
+ self.name = File.basename(obj.path)
56
+ when ::ActionDispatch::Http::UploadedFile
57
+ @initialized_tempfile = obj.tempfile
58
+ else
59
+ raise ArgumentError, "#{self.class.name} must be initialized with a String, a File, a Tempfile, an ActionDispatch::Http::UploadedFile or another TempObject"
60
+ end
61
+ self.name = obj.original_filename if obj.respond_to?(:original_filename)
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,5 @@
1
+ # Configuration for processing and encoding
2
+ app = Dragonfly::App[:noodall_assets]
3
+ app.configure_with(:imagemagick)
4
+ app.configure_with(:rails)
5
+ app.datastore = Dragonfly::DataStorage::MongoDataStore.new :db => MongoMapper.database
@@ -3,7 +3,7 @@ class PageA < Noodall::Node
3
3
  root_template!
4
4
 
5
5
  main_slots 1
6
- small_slots 4
6
+ small_slots 20
7
7
  wide_slots 3
8
8
 
9
9
  searchable_keys :title, :body, :description, :keywords
@@ -0,0 +1,24 @@
1
+ @javascript
2
+ Feature: Preview Content
3
+ In order to have a succinct page title, with a more descriptive browser title
4
+ A website editor
5
+ Will be able to set a separate browser title
6
+
7
+ Scenario: Don't set a browser title
8
+ Given I am editing content
9
+ And I fill in "Title" with "Bacon Ipsum"
10
+ When I press "Publish"
11
+ Then the content should be visible on the website
12
+ And the title should be "Bacon Ipsum"
13
+ And the browser title should be "Bacon Ipsum"
14
+
15
+
16
+ Scenario: Set a browser title
17
+ Given I am editing content
18
+ When I fill in "Title" with "Bacon Ipsum"
19
+ And I follow "Advanced"
20
+ And I fill in "Browser Title" with "Ice Cream"
21
+ And I press "Publish"
22
+ And I follow "Show"
23
+ Then the title should be "Bacon Ipsum"
24
+ And the browser title should be "Ice Cream"