noodall-ui 0.3.20 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,20 @@
1
+ Feature: Filter Branch
2
+ In order to easily find content in branches with lots of content
3
+ a website editor
4
+ will be able to filter by title key word
5
+
6
+ Scenario: Filter Branch
7
+ Given a content branch has the follow nodes
8
+ | title |
9
+ | home |
10
+ | home and away |
11
+ | neighbours |
12
+ | australia |
13
+ | home sweet home |
14
+ And I go to that page in the CMS
15
+ And I fill in "Filter by Title" with "Home"
16
+ And press "Filter"
17
+ Then I should see 3 nodes
18
+ And I fill in "Filter by Title" with "australia"
19
+ And press "Filter"
20
+ Then I should see 1 node
@@ -5,7 +5,7 @@ In order to control when content is available on the website a website administr
5
5
  Given content exists
6
6
  When I publish the content
7
7
  Then the content should be visible on the website
8
- When I save content as draft
8
+ When I hide the content
9
9
  Then the content should not be visible on the website
10
10
 
11
11
  Scenario: Publish content for set period
@@ -0,0 +1,34 @@
1
+ Feature: Work with drafts
2
+ In order on a new new version of content without publishing
3
+ A website editor
4
+ Will be able to save a draft
5
+
6
+ Scenario: Save a draft
7
+ Given I am editing content
8
+ And I make some changes
9
+ And I press "Draft"
10
+ Then I should see "was successfully saved as version 1 (draft)"
11
+ And the live page should be at version 0
12
+ When I go to edit the content again
13
+ Then I should see "You are editing a draft version of this page"
14
+ And the form should contain version 1
15
+
16
+ Given I go to edit the content again
17
+ And I press "Publish"
18
+ Then I should see "was successfully published"
19
+ Then the live page should be at version 2
20
+
21
+ Given I go to edit the content again
22
+ And I follow "Versions"
23
+ Then I should see a list of previous versions
24
+ When I follow "Use" within version 1
25
+ Then the form should contain version 1
26
+ When I press "Publish"
27
+ Then the live page should be at version 1
28
+
29
+ Scenario: View a version
30
+ Given content exists with several versions
31
+ When I go to edit the content again
32
+ And I follow "Versions"
33
+ And I follow "View" within version 1
34
+ Then I should see version 1 of the content
@@ -0,0 +1,7 @@
1
+ Then /^the title should be "([^"]*)"$/ do |text|
2
+ find(:xpath, "//h1[contains(text(),'#{text}')]").should_not(be_nil, "Could not find the text '#{text}' within the h1 tag")
3
+ end
4
+
5
+ Then /^the browser title should be "([^"]*)"$/ do |text|
6
+ find(:xpath, "//title[contains(text(),'#{text}')]").should_not(be_nil, "Could not find the text '#{text}' within the title tag")
7
+ end
@@ -81,7 +81,7 @@ Then /^I should be able to move a child content to another parent$/ do
81
81
  click_link "Advanced"
82
82
  within(:css, '#parent-title' ) { click_link "Edit" }
83
83
  within(:css, 'ol.tree' ) { click_link @_new_parent.title }
84
- click_button 'Draft'
84
+ click_button 'Publish'
85
85
  end
86
86
 
87
87
  Then /^I should see the child listed within the other parent’s children$/ do
@@ -185,3 +185,11 @@ Then /^I should see the course information box$/ do
185
185
  course_info.should contain('AB1234')
186
186
  end
187
187
  end
188
+
189
+
190
+ Given /^a content branch has the follow nodes$/ do |table|
191
+ @_content = Factory(:page_a, :title => 'Top Page', :publish => true)
192
+ table.hashes.each do |row|
193
+ @_subcontent = Factory(:page_a, :title => row['title'], :parent => @_content, :publish => true)
194
+ end
195
+ end
@@ -0,0 +1,39 @@
1
+ Given /^I make some changes$/ do
2
+ fill_in 'Title', :with => 'A new version'
3
+ end
4
+
5
+ Then /^the live page should be at version (\d+)$/ do |version|
6
+ @_content = Noodall::Node.find(@_content.id) # Reload the model to remove memoized versions (reload does not do this)
7
+ visit node_path(@_content)
8
+ version = @_content.version_at(version.to_i)
9
+ page.should have_content(version.content(:title))
10
+ end
11
+
12
+ Then /^the form should contain version (\d+)$/ do |version|
13
+ @_content = Noodall::Node.find(@_content.id) # Reload the model to remove memoized versions (reload does not do this)
14
+ version = @_content.version_at(version.to_i)
15
+ Then %{the "Title" field should contain "#{version.content(:title)}"}
16
+ end
17
+
18
+ Then /^I should see a list of previous versions$/ do
19
+ page.should have_css("table#versions-list tr", :count => @_content.all_versions.count)
20
+ end
21
+
22
+ When /^I follow "([^"]*)" within version (\d+)$/ do |link_name, version_number|
23
+ within "tr:contains('Version #{version_number}')" do
24
+ click_link link_name
25
+ end
26
+ end
27
+
28
+ Given /^content exists with several versions$/ do
29
+ @_content = Factory(:page_a)
30
+ 3.times do |i|
31
+ @_content.title = "Title #{i}"
32
+ @_content.save
33
+ end
34
+ end
35
+
36
+ Then /^I should see version (\d+) of the content$/ do |version|
37
+ version = @_content.version_at(version.to_i)
38
+ page.should have_content(version.content(:title))
39
+ end
@@ -30,6 +30,9 @@ Then /^I should see a page of xml$/ do
30
30
  end
31
31
 
32
32
  When /^I view the page "([^"]*)" as "([^"]*)"$/ do |title, format|
33
- visit node_path(Noodall::Node.find_by_title(title), format)
33
+ visit node_path(Noodall::Node.find_by_title(title), :format => format)
34
34
  end
35
35
 
36
+ Then /^I should see (\d+) nodes?$/ do |count|
37
+ page.should have_selector "tr.node", :count => count.to_i
38
+ end
@@ -7,9 +7,9 @@ When /^I publish the content$/ do
7
7
  click_button('Publish')
8
8
  end
9
9
 
10
- When /^I save content as draft$/ do
10
+ When /^I hide the content$/ do
11
11
  visit noodall_admin_node_path(@_content)
12
- click_button('Draft')
12
+ click_button('Hide')
13
13
  end
14
14
 
15
15
  Then /^the content should (not |)be visible on the website$/ do |is_not|
@@ -27,7 +27,7 @@ Given /^I publish content between "([^\"]*)" and "([^\"]*)"$/ do |from, to|
27
27
  select_datetime(from.to_time, :from => 'Publish at')
28
28
  select_datetime(to.to_time, :from => 'Publish until')
29
29
  click_button('Publish')
30
- page.should have_content('was successfully updated')
30
+ page.should have_content('was successfully published')
31
31
  end
32
32
 
33
33
 
@@ -217,3 +217,7 @@ end
217
217
  Then /^show me the page$/ do
218
218
  save_and_open_page
219
219
  end
220
+
221
+ Then /^debug$/ do
222
+ debugger
223
+ end
@@ -16,6 +16,8 @@ Spork.prefork do
16
16
  require 'cucumber/rails/world'
17
17
  require 'cucumber/web/tableish'
18
18
  require 'cucumber/rspec/doubles'
19
+
20
+ require 'ruby-debug'
19
21
 
20
22
  require 'capybara/rails'
21
23
  require 'capybara/cucumber'
@@ -41,7 +43,7 @@ Spork.each_run do
41
43
  # pages, more or less in the same way your application would behave in the
42
44
  # default production environment. It's not recommended to do this for all
43
45
  # of your scenarios, as this makes it hard to discover errors in your application.
44
- ActionController::Base.allow_rescue = false
46
+ #ActionController::Base.allow_rescue = false
45
47
 
46
48
  # How to clean your database when transactions are turned off. See
47
49
  # http://github.com/bmabey/database_cleaner for more info.
@@ -9,15 +9,17 @@ module NavigationHelpers
9
9
  def path_to(page_name)
10
10
  case page_name
11
11
 
12
- when /the (home\s?page|website)/i
12
+ when /^the (home\s?page|website)/i
13
13
  root_path
14
- when /the CMS/
14
+ when /^the CMS/
15
15
  '/admin'
16
16
  when /^the (?:root )?content titled "([^\"]*)" page$/i
17
17
  node = Node.find_by_title($1)
18
18
  node_path(node)
19
19
  when /^the content admin page$/
20
20
  noodall_admin_nodes_path
21
+ when /^edit the content again$/
22
+ noodall_admin_node_path(@_content)
21
23
  when /^the site ?map page$/
22
24
  noodall_sitemap_path
23
25
  when /^a page that's content is in the "([^\"]*)" template$/
@@ -35,7 +37,8 @@ module NavigationHelpers
35
37
  node_path(node)
36
38
  when /^that page$/
37
39
  node_path(@_content)
38
-
40
+ when /^that page in the CMS$/
41
+ noodall_admin_node_nodes_path(@_content)
39
42
  when /^the article list page$/
40
43
  node_path(@_content)
41
44
  when /content titled "([^\"]*)"$/
@@ -7,6 +7,7 @@ module Noodall
7
7
  namespace 'noodall/admin', :as => 'noodall_admin', :path => 'admin' do
8
8
  resources :nodes do
9
9
  resources :nodes
10
+ resources :versions
10
11
  member do
11
12
  get :change_template
12
13
  get :move_up
@@ -15,6 +16,7 @@ module Noodall
15
16
  end
16
17
  collection do
17
18
  get :tree
19
+ post :filter
18
20
  end
19
21
  end
20
22
 
@@ -38,10 +40,11 @@ module Noodall
38
40
  resources :groups
39
41
  end
40
42
 
43
+ get "v/:node_id/:id" => "noodall/nodes#version", :as => :noodall_version
41
44
  get "search" => "noodall/nodes#search", :as => :noodall_search
42
45
  get "sitemap" => "noodall/nodes#sitemap", :as => :noodall_sitemap
43
46
  get "*permalink.:format" => 'noodall/nodes#show'
44
- get "*permalink" => 'noodall/nodes#show', :as => :node_permalink
47
+ get "*permalink(.:format)" => 'noodall/nodes#show', :as => :node_permalink
45
48
  end
46
49
  end
47
50
  end
@@ -1,5 +1,5 @@
1
1
  module Noodall
2
2
  module UI
3
- VERSION = "0.3.20"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
data/noodall-ui.gemspec CHANGED
@@ -14,8 +14,8 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.required_rubygems_version = ">= 1.3.6"
16
16
 
17
- s.add_dependency 'noodall-core', ">= 0.6.0"
18
- s.add_dependency 'thoughtbot-sortable_table', ">= 0.0.6"
17
+ s.add_dependency 'noodall-core', ">= 0.7.2"
18
+ s.add_dependency 'thoughtbot-sortable_table', "= 0.0.6"
19
19
  s.add_dependency 'will_paginate', "~> 3.0.pre2"
20
20
  s.add_dependency 'dynamic_form', ">= 0"
21
21
 
File without changes
Binary file
Binary file
@@ -194,6 +194,8 @@ $(document).ready(function() {
194
194
  axis: 'y',
195
195
  handle: 'img'
196
196
  });
197
+
198
+ $('#versions-button').fancybox({'autoDimensions':false});
197
199
 
198
200
  // Add emptys div for browsers/preview
199
201
  $('body').append('<div style="display:none;"><div id="asset-browser"></div><div id="tree-browser"></div><div id="preview-pane"><iframe name="preview-frame" src="about:blank"/></div></div>');
@@ -265,6 +265,17 @@ p.remove span{
265
265
  position:absolute;
266
266
  }
267
267
 
268
+ #content form .fixed-form a#versions-button {
269
+ background:url(/images/admin/versions.gif) no-repeat;
270
+ width:110px;
271
+ height:26px;
272
+ left:440px;
273
+ top:20px;
274
+ border: none;
275
+ position:absolute;
276
+ }
277
+
278
+
268
279
  #content form .fixed-form input.draft {
269
280
  background:url(/images/admin/draft.gif) no-repeat;
270
281
  width:110px;
@@ -276,12 +287,23 @@ p.remove span{
276
287
 
277
288
  }
278
289
 
290
+ .fixed-form input#hide {
291
+ background:url(/images/admin/hide.gif) no-repeat;
292
+ width:160px;
293
+ height:56px;
294
+ cursor:pointer;
295
+ border: none;
296
+ position:absolute;
297
+ top:20px;
298
+ right:200px;
299
+ }
300
+
279
301
  .fixed-form a.cancel, .fixed-form a.delete {
280
302
  background:url(/images/admin/cancel.gif) no-repeat;
281
303
  width:160px;
282
304
  height:56px;
283
305
  cursor:pointer;
284
- border:none;
306
+ border:none;
285
307
  position:absolute;
286
308
  top:20px;
287
309
  right:20px;
@@ -392,6 +414,14 @@ div#flash div.error {
392
414
  color:#fff;
393
415
  }
394
416
 
417
+ div#flash div.alert {
418
+ background: #E19449;
419
+ border:3px solid #C46F1C;
420
+ color:#fff;
421
+ }
422
+
423
+
424
+
395
425
  div#flash a {
396
426
  color:#fff;
397
427
  }
@@ -522,4 +552,4 @@ fieldset.template label {
522
552
 
523
553
  .jqTransformHidden {
524
554
  display: none;
525
- }
555
+ }
@@ -117,21 +117,21 @@ div#content-table {
117
117
  clear:both;
118
118
  }
119
119
 
120
- div#content-table table.content {
120
+ table.content {
121
121
  width:100%;
122
122
  }
123
123
 
124
- div#content-table table.content th,
125
- div#content-table table.content td {
124
+ table.content th,
125
+ table.content td {
126
126
  padding:9px;
127
127
  vertical-align:middle;
128
128
  }
129
129
 
130
- div#content-table table.content th {
130
+ table.content th {
131
131
  padding:14px;
132
132
  }
133
133
 
134
- div#content-table table.content td label {
134
+ table.content td label {
135
135
  display:none;
136
136
  }
137
137
 
@@ -302,15 +302,15 @@ form#uploader {
302
302
  /* PAGINATION */
303
303
 
304
304
  .pagination {
305
- clear:both;
306
- margin:10px 0;
305
+ float:left;
306
+ margin:15px 0;
307
307
  height:26px;
308
308
  }
309
309
 
310
310
  .pagination span,
311
311
  .pagination em,
312
312
  .pagination a {
313
- padding:0 1px;
313
+ padding:0 5px;
314
314
  vertical-align: middle;
315
315
  }
316
316
 
@@ -412,7 +412,7 @@ td.child a.child-no{
412
412
  }
413
413
 
414
414
  span.check,
415
- span.draft {
415
+ span.hidden {
416
416
  width:26px;
417
417
  height:26px;
418
418
  display:block;
@@ -772,7 +772,39 @@ li.multi-file .file-detail img {clear:both;float:left;}
772
772
  }
773
773
 
774
774
 
775
+ /* -------------- Admin filtering -------------- */
776
+ #form-filter {
777
+ float: right;
778
+ margin: 0px 0 10px 0;
779
+ width: 321px;
780
+ }
781
+
782
+ #form-filter form input[type="text"] {
783
+ float:left;
784
+ margin: 0 20px 0 0;
785
+ width: 200px;
786
+ background: none repeat scroll 0 0 #FFFFFF;
787
+ border: 1px solid #C2C2C2;
788
+ padding: 8px;
789
+ }
775
790
 
791
+ #form-filter form input[type="submit"] {
792
+ float:left;
793
+ width: 80px;
794
+ background: none repeat scroll 0 0 #93bf65;
795
+ border: 5px solid #659132;
796
+ padding: 5px;
797
+ -webkit-border-radius: 5px;
798
+ -moz-border-radius: 5px;
799
+ border-radius: 5px;
800
+ color: #fff;
801
+ font-weight: bold;
802
+ text-transform:uppercase;
803
+ font-size: 10px;
804
+ text-shadow: 2px 2px 2px #659132;
805
+ filter: dropshadow(color=#659132, offx=2, offy=2);
806
+ margin: 0;
807
+ }
776
808
 
777
809
  /* -------------- CLEARFIX -------------- */
778
810