adva-core 0.0.6 → 0.0.7

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 (31) hide show
  1. data/app/controllers/base_controller.rb +48 -2
  2. data/app/views/layouts/admin.rb +0 -5
  3. data/app/views/layouts/base.rb +1 -0
  4. data/lib/adva/generators/engine.rb +14 -6
  5. data/lib/adva/generators/templates/engine/env.rb +3 -0
  6. data/lib/adva/generators/templates/engine/feature.erb +3 -0
  7. data/lib/adva/generators/templates/engine/paths.rb.erb +12 -0
  8. data/lib/adva/generators/templates/engine/routes.rb.erb +2 -2
  9. data/lib/adva/generators/templates/engine/test_helper.rb.erb +1 -1
  10. data/lib/adva_core/version.rb +1 -1
  11. data/lib/patches/inherited_resources.rb +1 -1
  12. data/lib/patches/rails/integretion_runner_respond_to.rb +1 -1
  13. data/lib/patches/rails/route_set_trailing_segment.rb +1 -1
  14. data/lib/patches/rails/sti_associations.rb +1 -1
  15. data/lib/patches/simple_form.rb +1 -1
  16. data/lib/patches/webrat/links-data-method.rb +1 -1
  17. data/lib/patches/webrat/logger.rb +1 -1
  18. data/lib/patches/webrat/upload_file.rb +1 -1
  19. data/lib/testing/assertions.rb +4 -0
  20. data/lib/testing/helpers/global_helpers.rb +12 -1
  21. data/lib/testing/paths.rb +5 -0
  22. data/lib/testing/step_definitions/common_steps.rb +84 -16
  23. data/lib/testing/step_definitions/transforms.rb +1 -1
  24. data/lib/webrat/integrations/rails.rb +1 -1
  25. data/public/images/adva-core/admin/closed.png +0 -0
  26. data/public/images/adva-core/admin/open.png +0 -0
  27. data/public/javascripts/adva-core/admin.js +6 -0
  28. data/public/stylesheets/adva-core/admin/lists.css +27 -5
  29. data/public/stylesheets/adva-core/admin/styles.css +6 -0
  30. metadata +25 -21
  31. data/lib/patches/arel_in_subquery.rb +0 -44
@@ -8,11 +8,57 @@ class BaseController < InheritedResources::Base
8
8
  layout 'default'
9
9
  helper_method :site
10
10
 
11
- def self.responder
12
- Adva::Responder
11
+ mattr_accessor :sortable
12
+ self.sortable = []
13
+
14
+ class << self
15
+ def responder
16
+ Adva::Responder
17
+ end
18
+
19
+ def sortable?(order)
20
+ !!sortable_direction(order)
21
+ end
22
+
23
+ def sortable_direction(order)
24
+ self.sortable.assoc(order.to_sym).last rescue nil
25
+ end
13
26
  end
14
27
 
15
28
  def site
16
29
  @site ||= Site.by_host(request.host_with_port)
17
30
  end
31
+
32
+ def collection
33
+ params[:order].present? ? sort(super, params[:order]) : super
34
+ end
35
+
36
+ protected
37
+
38
+ def sort(collection, order)
39
+ if !self.class.sortable?(order)
40
+ collection
41
+ elsif collection.respond_to?(order)
42
+ collection.send(order)
43
+ elsif collection.arel_table[order]
44
+ collection.order(collection.arel_table[order].send(self.class.sortable_direction(order)))
45
+ else
46
+ collection
47
+ end
48
+ end
18
49
  end
50
+
51
+ # ActiveRecord::Base.class_eval do
52
+ # mattr_reader :sortable
53
+ # self.sortable = []
54
+ #
55
+ # class << self
56
+ # def sortable_by?(name)
57
+ # sortable.include?(name)
58
+ # end
59
+ #
60
+ # def sort_by(name)
61
+ # sortable_by?(name) && respond_to?(name) : send(name) : self
62
+ # end
63
+ # end
64
+ # end
@@ -1,11 +1,6 @@
1
1
  module Layouts
2
2
  class Admin < Layouts::Base
3
3
  include do
4
- def head
5
- csrf_meta_tag
6
- super
7
- end
8
-
9
4
  def body
10
5
  div do
11
6
  header
@@ -18,6 +18,7 @@ class Layouts::Base < Minimal::Template
18
18
  title
19
19
  stylesheets
20
20
  javascripts
21
+ csrf_meta_tag
21
22
  block.call(:head)
22
23
  end
23
24
 
@@ -4,14 +4,14 @@ module Adva
4
4
  module Generators
5
5
  class Engine < Rails::Generators::Base
6
6
  source_root File.expand_path('../templates/engine', __FILE__)
7
-
7
+
8
8
  attr_reader :name
9
-
9
+
10
10
  def initialize(name, options = {})
11
11
  @name = name
12
12
  super()
13
13
  end
14
-
14
+
15
15
  def build
16
16
  empty_directory "adva-#{name}"
17
17
  template "gemspec.erb", "adva-#{name}/adva-#{name}.gemspec"
@@ -31,15 +31,23 @@ module Adva
31
31
  empty_directory "adva-#{name}/db/migrate"
32
32
  template 'migration.rb.erb', "adva-#{name}/db/migrate/#{migration_timestamp}_adva_#{name}_create_tables.rb"
33
33
 
34
+ empty_directory "adva-#{name}/features"
35
+ template 'env.rb', "adva-#{name}/features/env.rb"
36
+ template 'feature.erb', "adva-#{name}/features/#{name}.feature"
37
+
34
38
  empty_directory "adva-#{name}/lib/adva"
35
39
  create_file "adva-#{name}/lib/adva-#{name}.rb", "require 'adva/#{name}'"
36
40
  template 'engine.rb.erb', "adva-#{name}/lib/adva/#{name}.rb"
37
41
 
42
+ empty_directory "adva-#{name}/lib/testing"
43
+ create_file "adva-#{name}/lib/paths.rb", "adva-#{name}/lib/step_definitions.rb"
44
+ template 'paths.rb.erb', "adva-#{name}/lib/testing/paths.rb"
45
+
38
46
  empty_directory "adva-#{name}/test"
39
47
  template 'all.rb', "adva-#{name}/test/all.rb"
40
48
  template 'test_helper.rb.erb', "adva-#{name}/test/test_helper.rb"
41
49
  end
42
-
50
+
43
51
  protected
44
52
 
45
53
  def migration_timestamp
@@ -49,10 +57,10 @@ module Adva
49
57
  def table_name
50
58
  name.tableize
51
59
  end
52
-
60
+
53
61
  def class_name
54
62
  name.camelize
55
63
  end
56
64
  end
57
65
  end
58
- end
66
+ end
@@ -0,0 +1,3 @@
1
+ require File.expand_path('../../../features/env', __FILE__)
2
+
3
+
@@ -0,0 +1,3 @@
1
+ Feature: <%= name.titleize %>
2
+
3
+ Scenario:
@@ -0,0 +1,12 @@
1
+ module Adva::<%= name.classify %>::Paths
2
+ def path_to(page)
3
+ case page
4
+ when 'path/to/<%= name %>'
5
+ else
6
+ super
7
+ end
8
+ end
9
+ end
10
+ World(Adva::<%= name.classify %>::Paths)
11
+
12
+
@@ -1,3 +1,3 @@
1
1
  # Rails.application.routes.draw do
2
- # resource :<%= name %>
3
- # end
2
+ # resources :<%= name %>
3
+ # end
@@ -1,3 +1,3 @@
1
- require File.expand_path('../../../adva-core/test/test_helper', __FILE__)
1
+ require File.expand_path('../../../test/test_helper', __FILE__)
2
2
 
3
3
  require 'adva-<%= name %>'
@@ -1,3 +1,3 @@
1
1
  module AdvaCore
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -1,4 +1,4 @@
1
- require 'gem_patching'
1
+ require 'gem-patching'
2
2
  require 'inherited_resources'
3
3
 
4
4
  Gem.patching('inherited_resources', '1.1.2') do
@@ -1,4 +1,4 @@
1
- require 'gem_patching'
1
+ require 'gem-patching'
2
2
 
3
3
  # ActionDispatch::Integration::Runner defines method_missing but no accompaning
4
4
  # respond_to? method. It thus doesn't respond_to? to named route url helpers even
@@ -1,4 +1,4 @@
1
- require 'gem_patching'
1
+ require 'gem-patching'
2
2
 
3
3
  # remove trailing segments '.1' and query params '?=1' from url
4
4
  Gem.patching('rails', '3.0.3') do
@@ -1,4 +1,4 @@
1
- require 'gem_patching'
1
+ require 'gem-patching'
2
2
 
3
3
  # Make build associations have their given type
4
4
  # i.e.: site.sections.build(:type => 'Page').class == Page
@@ -1,4 +1,4 @@
1
- require 'gem_patching'
1
+ require 'gem-patching'
2
2
 
3
3
  # add "blog edit_blog" as css classes. should propose a patch to simple_form
4
4
 
@@ -1,4 +1,4 @@
1
- require 'gem_patching'
1
+ require 'gem-patching'
2
2
 
3
3
  Gem.patching('webrat', '0.7.2') do
4
4
  Webrat::Link.class_eval do
@@ -1,4 +1,4 @@
1
- require 'gem_patching'
1
+ require 'gem-patching'
2
2
 
3
3
  Gem.patching('webrat', '0.7.2') do
4
4
  Webrat::Logging.class_eval do
@@ -1,4 +1,4 @@
1
- require 'gem_patching'
1
+ require 'gem-patching'
2
2
 
3
3
  Gem.patching('webrat', '0.7.2') do
4
4
  Webrat::FileField.class_eval do
@@ -1,3 +1,7 @@
1
+ def assert_html(html, *args, &block)
2
+ assert_select(HTML::Document.new(html).root, *args, &block)
3
+ end
4
+
1
5
  def emails_for_assertion(attributes)
2
6
  ::ActionMailer::Base.deliveries.select do |email|
3
7
  attributes.all? do |name, value|
@@ -3,7 +3,18 @@ module GlobalHelpers
3
3
  Site.first || raise("Could not find a site. Maybe you want to set one up in your story background?")
4
4
  end
5
5
 
6
+ def user
7
+ @user || raise("@current_user is not set. Maybe you want to sign in first?")
8
+ end
9
+
6
10
  def account
7
11
  Account.first || raise("Could not find a site. Maybe you want to set one up in your story background?")
8
12
  end
9
- end
13
+
14
+ def parsed_html
15
+ # memoizing this causes problems since it seems to be memoized across requests
16
+ # TODO: Figure out way to memoize within one request only
17
+ # @parsed_body ||= Nokogiri::HTML(response.body)
18
+ Nokogiri::HTML(response.body)
19
+ end
20
+ end
@@ -18,6 +18,11 @@ module Adva::Core::Paths
18
18
  section = Section.where(:name => $1).first || raise("could not find section named #{$1}")
19
19
  polymorphic_path(section)
20
20
 
21
+ # the "Catalog" section page, ordered by "most viewed"
22
+ when /,? ordered by "([^\"]*)"$/
23
+ order = $1
24
+ path_to(page.gsub(/,? ordered by "[^\"]*"$/, '')) + "?order=#{order.gsub(' ', '_')}"
25
+
21
26
  when /^the admin sites page$/
22
27
  polymorphic_path([:admin, :sites])
23
28
 
@@ -78,16 +78,29 @@ When /^(.+) that link$/ do |step|
78
78
  When %(#{step} "#{@last_link}")
79
79
  end
80
80
 
81
- When /^I (press|click) "(.*)" in the row (of the ([a-z ]+) table )?where "(.*)" is "(.*)"$/ do |press_or_click, link_or_button, _, table_id, header, cell_content|
81
+ When /^I (press|click|follow) "(.*)" in the row (of the ([a-z ]+) table )?where "(.*)" is "(.*)"$/ do |action, target, _, table_id, header, content|
82
82
  body = Nokogiri::HTML(response.body)
83
83
  table_xpath = table_id.nil? ? 'table' : "table[@id='#{table_id.gsub(/ /, '_')}']"
84
- table_header_cells = body.xpath("//#{table_xpath}/descendant::th[normalize-space(text())='#{header}']/@id")
85
- assert !table_header_cells.empty?, "could not find table header cell '#{header}'"
86
- header_id = body.xpath("//#{table_xpath}/descendant::th[normalize-space(text())='#{header}']/@id").first.value
87
- row_id = body.xpath("//#{table_xpath}/descendant::td[@headers='#{header_id}'][normalize-space(text())='#{cell_content}']/ancestor::tr/@id").first.value
88
- within("##{row_id}") do
89
- send({'press' => 'click_button', 'click' => 'click_link'}[press_or_click], link_or_button)
90
- end
84
+ headers = body.xpath("//#{table_xpath}/descendant::th[normalize-space(text())='#{header}']/@id")
85
+ assert !headers.empty?, "could not find table header cell #{header.inspect}"
86
+
87
+ header_id = headers.first.value
88
+ cell_path = "//#{table_xpath}/descendant::td[@headers='#{header_id}']"
89
+ content = "normalize-space(text())='#{content}'"
90
+ tag_path = "#{cell_path}[#{content}]/ancestor::tr/@id"
91
+ nested_tag_path = "#{cell_path}/descendant::*[#{content}]/ancestor::tr/@id"
92
+
93
+ rows = body.xpath([tag_path, nested_tag_path].join('|'))
94
+ assert !rows.empty?, "could not find table row where a cell has the header id #{header_id.inspect} and the content #{content.inspect}"
95
+
96
+ map = { 'press' => 'click_button', 'click' => 'click_link' }
97
+ within("##{rows.first.value}") { map[action] ? send(map[action], target) : When(%(I #{action} "#{target}")) }
98
+ end
99
+
100
+ When /^I order the (.*)s list by "([^"]*)"$/ do |model, order|
101
+ When %(I select "#{order}" from "#{model}s_order")
102
+ select = Webrat::Locators::FieldLocator.new(webrat, webrat.dom, "#{model}s_order", Webrat::SelectField).locate!
103
+ select.send(:form).submit
91
104
  end
92
105
 
93
106
  When /^I visit the url from the email to (.*)$/ do |to|
@@ -97,6 +110,10 @@ When /^I visit the url from the email to (.*)$/ do |to|
97
110
  visit(url)
98
111
  end
99
112
 
113
+ # Examples:
114
+ # I should see a product row where "Name" is "Apple Powerbook"
115
+ # I should not see a product row where "Name" is "Apple Powerbook"
116
+ # I should see a row in the products table where "Name" is "Apple Powerbook"
100
117
  Then /^I should (not )?see a ([a-z ]+ )?row (?:of the ([a-z ]+) table )?where "(.*)" is "(.*)"$/ do |optional_not, row_classes, table_id, header, cell_content|
101
118
  body = Nokogiri::HTML(response.body)
102
119
  table_xpath = table_id.nil? ? 'table' : "table[@id='#{table_id.gsub(/ /, '_')}']"
@@ -111,7 +128,7 @@ Then /^I should (not )?see a ([a-z ]+ )?row (?:of the ([a-z ]+) table )?where "(
111
128
  "contains(concat(' ', normalize-space(@class), ' '), ' #{row_class} ')"
112
129
  end.join(' and ')
113
130
  tr_xpath = class_condition.empty? ? 'ancestor::tr' : "ancestor::tr[#{class_condition}]"
114
- xpath_result = body.xpath("//#{table_xpath}/descendant::td[@headers='#{header_id}'][normalize-space(text())='#{cell_content}']/#{tr_xpath}/@id")
131
+ xpath_result = body.xpath("//#{table_xpath}/descendant::td[@headers='#{header_id}'][normalize-space(text())='#{cell_content}']/#{tr_xpath}")
115
132
 
116
133
  if optional_not.present?
117
134
  assert xpath_result.empty?, "Expected not find a row where #{header.inspect} is #{cell_content}."
@@ -158,6 +175,8 @@ Then /^the title should be "([^"]+)"$/ do |title|
158
175
  assert_select('title', title)
159
176
  end
160
177
 
178
+ # TODO: This is an almost duplicate step
179
+ # Use the one with un-quoted 'thing' expression
161
180
  Then /^I should see (an?|the) "([^"]+)"$/ do |kind, thing|
162
181
  kind = { 'a' => '.', 'the' => '#' }[kind]
163
182
  assert_select("#{kind}#{thing}")
@@ -168,14 +187,21 @@ Then /^I should see a link "([^"]+)"$/ do |link|
168
187
  assert_select('a', link)
169
188
  end
170
189
 
171
- Then /^I should not see any (\w+)$/ do |type|
172
- assert_select(".#{type.singularize}", :count => 0) # .#{type},
190
+ Then /^I should not see any ([a-z_ ]+)$/ do |type|
191
+ assert_select(".#{type.gsub(' ', '_').singularize}", :count => 0)
173
192
  end
174
193
 
175
194
  Then /^I should see an? (\w+)$/ do |type|
176
195
  assert_select(".#{type}")
177
196
  end
178
197
 
198
+ Then /^I should see a "([^"]*)" select box with the following options:$/ do |name, options|
199
+ select = Webrat::Locators::FieldLocator.new(webrat, webrat.dom, 'products_order', Webrat::SelectField).locate!
200
+ actual = select.options.map(&:inner_text).uniq
201
+ expected = options.raw.flatten[1..-1] # ignores the first row
202
+ assert_equal expected, actual
203
+ end
204
+
179
205
  Then /^I should see an? (\w+) (?:titled|named) "([^"]+)"$/ do |type, text|
180
206
  assert_select(".#{type} h2", text)
181
207
  end
@@ -184,6 +210,18 @@ Then /^I should see an? (\w+) containing "([^"]+)"$/ do |type, text|
184
210
  assert_select(".#{type}", /#{text}/)
185
211
  end
186
212
 
213
+ # TODO: the sinature of this step should really be:
214
+ # I should see 'foo' within 'bar'
215
+ # However, the generic "within 'bar'" meta step uses 'within' which doesn't currently work with assertions
216
+ # only with navigation ('click', 'press')
217
+ Then /^the ([^"]+) should(?: (not))? contain "([^"]+)"$/ do |container_name, optional_negation, text|
218
+ container_id = container_name.gsub(' ', '_')
219
+ # 'within' doesn't currently work with assertions, so we need to resort to xpath
220
+ # within('#' + container_id) { assert_contain text }
221
+ assert(parsed_html.xpath("//*[@id=\"#{container_id}\"]").any?, "Could not find the #{container_name}")
222
+ assert(parsed_html.xpath("//*[@id=\"#{container_id}\"]/descendant::*[contains(normalize-space(text()), \"#{text}\")]").send(optional_negation ? :'none?' : :'any?'), "Could not see '#{text}' in the #{container_name}")
223
+ end
224
+
187
225
  Then /^I should see an? (\w+) list$/ do |type|
188
226
  assert_select(".#{type}.list")
189
227
  end
@@ -192,6 +230,16 @@ Then /^I should see a list of (\w+)$/ do |type|
192
230
  assert_select(".#{type}.list")
193
231
  end
194
232
 
233
+ Then /^the (.*) list should display (.*)s in the following order:$/ do |list, model, values|
234
+ expected = values.raw.flatten
235
+ name = expected.shift
236
+ selector = "##{list}.list tr td.#{name}"
237
+ rows = parsed_html.css(selector)
238
+
239
+ assert !rows.empty?, "could not find any elements matching #{selector.inspect}"
240
+ assert_equal expected, rows.map(&:content)
241
+ end
242
+
195
243
  Then /^I should see an? ([a-z ]+) form$/ do |type|
196
244
  tokens = type.split(' ')
197
245
  types = [tokens.join('_'), tokens.reverse.join('_')]
@@ -219,13 +267,24 @@ Then /^I should see a "(.+)" table with the following entries:$/ do |table_id, e
219
267
  diff_table = expected_table.dup
220
268
  diff_table.diff!(actual_table.dup)
221
269
  rescue
222
- puts "\nActual table:#{actual_table.to_s}\n"
223
- puts "Expected table:#{expected_table.to_s}\n"
224
- puts "Difference:#{diff_table.to_s}\n"
270
+ puts tables_differ_message(actual_table, expected_table, diff_table)
225
271
  raise
226
272
  end
227
273
  end
228
274
 
275
+ Then /^I should see a "(.+)" table with the following entries in no particular order:$/ do |table_id, expected_table|
276
+ actual_table = table(tableish("table##{table_id} tr", 'td,th'))
277
+ expected_rows = expected_table.raw
278
+ actual_rows = actual_table.raw.transpose.select { |row| expected_rows.first.include?(row.first) }.transpose
279
+ assert_equal expected_rows.to_set, actual_rows.to_set, tables_differ_message(actual_table, expected_table)
280
+ end
281
+
282
+ def tables_differ_message(actual, expected, diff = nil)
283
+ msg = "\nActual table:#{actual.to_s}\nExpected table:#{expected.to_s}\n"
284
+ msg += "Difference:#{diff.to_s}\n" if diff
285
+ msg
286
+ end
287
+
229
288
  Then /^I should see the "([^"]+)" page$/ do |name|
230
289
  assert_select('h2', name)
231
290
  end
@@ -289,7 +348,8 @@ Then /^I should see "([^"]*)" formatted as a "([^"]*)" tag$/ do |value, tag|
289
348
  assert_select(tag, value)
290
349
  end
291
350
 
292
- Then /^I should see (\d+|no|one|two|three) ([a-z ]+)$/ do |amount, item_class|
351
+ Then(/^I should see (\d+|no|one|two|three) ([a-z ]+?)(?: in the ([a-z ]+))?$/) do |amount, item_class, container_id|
352
+ container_selector = container_id ? '#' + container_id.gsub(' ', '_') : nil
293
353
  amount = case amount
294
354
  when 'no' then 0
295
355
  when 'one' then 1
@@ -297,6 +357,14 @@ Then /^I should see (\d+|no|one|two|three) ([a-z ]+)$/ do |amount, item_class|
297
357
  when 'three' then 3
298
358
  else amount.to_i
299
359
  end
300
- assert_select ".#{item_class.gsub(' ', '_').singularize}", :count => amount
360
+ item_selector = '.' + item_class.gsub(' ', '_').singularize
361
+ # assertions do not work with 'within' yet, so we need to resort to cancatenating selectors:
362
+ # container_selector ? within(container_selector) { assert_select(item_selector) } : assert_select(item_selector)
363
+ if container_selector
364
+ assert_select container_selector
365
+ assert_select [container_selector, item_selector].join(' '), amount
366
+ else
367
+ assert_select item_selector, amount
368
+ end
301
369
  end
302
370
 
@@ -3,7 +3,7 @@
3
3
  # works for both normal tables and row_hash tables):
4
4
  timezonify = lambda do |table|
5
5
  dates = table.headers.select { |header| header =~ /(_at|_on)$/ }
6
- dates.each { |date| table.map_column!(date) { |date| DateTime.parse(date).in_time_zone } }
6
+ dates.each { |date| table.map_column!(date) { |date| DateTime.parse(date).in_time_zone if date.present? && date != '-' } }
7
7
  table.transpose
8
8
  end
9
9
 
@@ -1,7 +1,7 @@
1
1
  # webrat/integrations/rails.rb requires 'action_controller/integration' which
2
2
  # does not exist in rails 3 any more. so we gotta replace the whole file.
3
3
 
4
- require 'gem_patching'
4
+ require 'gem-patching'
5
5
 
6
6
  Gem.patching('webrat', '0.7.2') do
7
7
  require "action_controller"
@@ -19,4 +19,10 @@ $(document).ready(function() {
19
19
  $(selected).addClass('active');
20
20
  });
21
21
 
22
+ $('table.list .toggle').click(function(event) {
23
+ $(this).hasClass('open') ? $(this).removeClass('open').addClass('closed') : $(this).removeClass('closed').addClass('open');
24
+ $(this).closest('tr').next().toggle();
25
+ event.stopPropagation();
26
+ return false;
27
+ });
22
28
  });
@@ -11,7 +11,7 @@ table.list thead tr:last-child th {
11
11
  border-bottom: 3px solid #ddd;
12
12
  }
13
13
  table.list tbody tr {
14
- border-bottom: 1px solid #ddd;
14
+ border-bottom: 1px solid #ddd;
15
15
  }
16
16
  table.list tbody td {
17
17
  position: relative;
@@ -36,19 +36,41 @@ table.list span.status {
36
36
  padding-left: 10px;
37
37
  display: inline-block;
38
38
  width: 16px;
39
- height: 16px;
39
+ height: 16px;
40
40
  margin-left: 4px;
41
41
  text-indent: 16px;
42
42
  overflow: hidden;
43
43
  vertical-align: middle;
44
+ background-repeat: no-repeat;
45
+ }
46
+ table.list td.status {
47
+ width: 24px;
48
+ background-position: 4px 8px;
49
+ background-repeat: no-repeat;
44
50
  }
45
51
 
52
+ table.list tr.published td.status,
46
53
  table.list span.published {
47
- background: url(/images/adva-core/icons/tick.png) no-repeat;
54
+ background-image: url(/images/adva-core/icons/tick.png);
48
55
  }
49
56
  table.list span.draft,
50
57
  table.list span.hold,
51
58
  table.list span.queued,
52
- table.list span.pending {
53
- background: url(/images/adva-core/icons/hourglass.png) no-repeat;
59
+ table.list span.pending,
60
+ table.list span.unpublished,
61
+ table.list tr.unpublished td.status {
62
+ background-image: url(/images/adva-core/icons/hourglass.png);
63
+ }
64
+
65
+ table.list .toggle {
66
+ padding-left: 18px;
67
+ background-position: 0 2px;
68
+ background-repeat: no-repeat;
69
+ background-image: url(/images/adva-core/admin/closed.png);
70
+ }
71
+ table.list .toggle.open {
72
+ background-image: url(/images/adva-core/admin/open.png);
73
+ }
74
+ table.list tr.details {
75
+ display: none;
54
76
  }
@@ -89,6 +89,12 @@ ul.links li:before {
89
89
  .actions a.destroy {
90
90
  background: url(/images/adva-core/icons/bin_closed.png) no-repeat -5px top;
91
91
  }
92
+ .actions a.publish {
93
+ background: url('/images/adva-core/icons/tick.png');
94
+ }
95
+ .actions a.unpublish {
96
+ background: url('/images/adva-core/icons/delete.png');
97
+ }
92
98
 
93
99
 
94
100
  div.pagination {
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adva-core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ingo Weiss
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-01-14 00:00:00 +01:00
19
+ date: 2011-01-31 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -59,28 +59,28 @@ dependencies:
59
59
  requirements:
60
60
  - - "="
61
61
  - !ruby/object:Gem::Version
62
- hash: 29
62
+ hash: 27
63
63
  segments:
64
64
  - 0
65
65
  - 0
66
- - 1
67
- version: 0.0.1
66
+ - 2
67
+ version: 0.0.2
68
68
  type: :runtime
69
69
  version_requirements: *id003
70
70
  - !ruby/object:Gem::Dependency
71
- name: gem_patching
71
+ name: gem-patching
72
72
  prerelease: false
73
73
  requirement: &id004 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - "="
77
77
  - !ruby/object:Gem::Version
78
- hash: 27
78
+ hash: 25
79
79
  segments:
80
80
  - 0
81
81
  - 0
82
- - 2
83
- version: 0.0.2
82
+ - 3
83
+ version: 0.0.3
84
84
  type: :runtime
85
85
  version_requirements: *id004
86
86
  - !ruby/object:Gem::Dependency
@@ -139,12 +139,12 @@ dependencies:
139
139
  requirements:
140
140
  - - "="
141
141
  - !ruby/object:Gem::Version
142
- hash: 47
142
+ hash: 45
143
143
  segments:
144
144
  - 0
145
145
  - 0
146
- - 24
147
- version: 0.0.24
146
+ - 25
147
+ version: 0.0.25
148
148
  type: :runtime
149
149
  version_requirements: *id008
150
150
  - !ruby/object:Gem::Dependency
@@ -187,12 +187,12 @@ dependencies:
187
187
  requirements:
188
188
  - - "="
189
189
  - !ruby/object:Gem::Version
190
- hash: 3
190
+ hash: 63
191
191
  segments:
192
192
  - 0
193
193
  - 0
194
- - 14
195
- version: 0.0.14
194
+ - 16
195
+ version: 0.0.16
196
196
  type: :runtime
197
197
  version_requirements: *id011
198
198
  - !ruby/object:Gem::Dependency
@@ -203,12 +203,12 @@ dependencies:
203
203
  requirements:
204
204
  - - "="
205
205
  - !ruby/object:Gem::Version
206
- hash: 39
206
+ hash: 37
207
207
  segments:
208
208
  - 0
209
209
  - 0
210
- - 28
211
- version: 0.0.28
210
+ - 29
211
+ version: 0.0.29
212
212
  type: :runtime
213
213
  version_requirements: *id012
214
214
  - !ruby/object:Gem::Dependency
@@ -337,7 +337,6 @@ files:
337
337
  - lib/patches/inherited_resources.rb
338
338
  - lib/patches/responders/flash_responder.rb
339
339
  - lib/patches/simple_form.rb
340
- - lib/patches/arel_in_subquery.rb
341
340
  - lib/patches/thor/group/symbolized_options.rb
342
341
  - lib/patches/thor/core_ext/hash.rb
343
342
  - lib/adva-core.rb
@@ -354,7 +353,10 @@ files:
354
353
  - lib/adva/generators/install.rb
355
354
  - lib/adva/generators/gemfile.rb
356
355
  - lib/adva/generators/templates/engine/migration.rb.erb
356
+ - lib/adva/generators/templates/engine/feature.erb
357
357
  - lib/adva/generators/templates/engine/test_helper.rb.erb
358
+ - lib/adva/generators/templates/engine/paths.rb.erb
359
+ - lib/adva/generators/templates/engine/env.rb
358
360
  - lib/adva/generators/templates/engine/engine.rb.erb
359
361
  - lib/adva/generators/templates/engine/routes.rb.erb
360
362
  - lib/adva/generators/templates/engine/en.yml.erb
@@ -548,9 +550,11 @@ files:
548
550
  - public/images/adva-core/admin/tab_action_active.png
549
551
  - public/images/adva-core/admin/tab_sidebar_active.png
550
552
  - public/images/adva-core/admin/tab_main_active.png
553
+ - public/images/adva-core/admin/open.png
551
554
  - public/images/adva-core/admin/header_bg.png
552
555
  - public/images/adva-core/admin/tab_top_active.png
553
556
  - public/images/adva-core/admin/menu_checkmark.png
557
+ - public/images/adva-core/admin/closed.png
554
558
  - public/images/adva-core/filter-bg.png
555
559
  - public/images/adva-core/grid.png
556
560
  - public/images/adva-core/theme_selected.png
@@ -1,44 +0,0 @@
1
- # https://gist.github.com/730257
2
- # bars.where(bars[:id].in(foos.project(:bar_id).where(...)))
3
-
4
- Gem.patching('arel', '2.0.6') do
5
- Arel::Predications.module_eval do
6
- def in_with_select_fix(other)
7
- case other
8
- when Arel::SelectManager
9
- Arel::Nodes::In.new(self, other)
10
- else
11
- in_without_select_fix(other)
12
- end
13
- end
14
- alias_method_chain :in, :select_fix
15
-
16
- def not_in_with_select_fix(other)
17
- case other
18
- when Arel::SelectManager
19
- Arel::Nodes::NotIn.new(self, other)
20
- else
21
- in_without_select_fix(other)
22
- end
23
- end
24
- alias_method_chain :not_in, :select_fix
25
- end
26
-
27
- Arel::Visitors::ToSql.class_eval do
28
- def visit_Arel_SelectManager o
29
- o.to_sql
30
- end
31
-
32
- def visit_Arel_Nodes_In o
33
- "#{visit o.left} IN (#{visit o.right})"
34
- end
35
-
36
- def visit_Arel_Nodes_NotIn o
37
- "#{visit o.left} NOT IN (#{visit o.right})"
38
- end
39
-
40
- def visit_Array o
41
- o.empty? ? 'NULL' : o.map { |x| visit x }.join(', ')
42
- end
43
- end
44
- end