hydra-editor 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 693381922df32a3e9b427e823df2cb5ca4294671
4
- data.tar.gz: aa9137e5123dc8a8785b9d90c5d5ddb64327beda
3
+ metadata.gz: 79829b582cd67317fe3dd9ca93973022d5faf33f
4
+ data.tar.gz: 800b69b756b5029c4b4cce692f2cc80fcc0a384d
5
5
  SHA512:
6
- metadata.gz: 9dc2258a9cdb3388c9cdad0eaa450def128bc0a2ce71a2792d5a0388de15bef7e45f6458fa1ba07e392e3bace542d520527d9fbb5640d9891143e9901709bacb
7
- data.tar.gz: 4c0b0aee0c443adcbe18218711791e38ac688d6fb1368ce75bf53d5a350d6e25f5718e8ebbf2f46f30e3eedef308c83cfe75a71a00b037bc4d53794a21f42887
6
+ metadata.gz: ffb00e067dd04edaec73fd812c96a91cfbbda411a65964abc4bda920a5fa5780bfcbfdaf34cf3dcbd4611d2cd3f8c3c08195dbd16ce2bb40c409c1efc060599c
7
+ data.tar.gz: d3f8175ab883da5c33469042958b7ae017a415d0c0a11e6599e4c1ad04a25477c47d4e06175ecc0dcaaf14c1eb66d1c4ef01daf13a9f997073b8a06383039e2a
data/Rakefile CHANGED
@@ -26,10 +26,12 @@ Bundler::GemHelper.install_tasks
26
26
  dummy = File.expand_path('../spec/dummy', __FILE__)
27
27
  rakefile = File.join(dummy, 'Rakefile')
28
28
 
29
+ desc "Remove the dummy app"
29
30
  task :clean do
30
31
  sh "rm -rf #{dummy}"
31
32
  end
32
33
 
34
+ desc "Generate the dummy app"
33
35
  task :setup do
34
36
  unless File.exists?("#{dummy}/Rakefile")
35
37
  `rails new #{dummy}`
@@ -43,10 +45,12 @@ task :setup do
43
45
  sh "rails generate test_app"
44
46
  puts "running migrations"
45
47
  sh 'rake db:migrate db:test:prepare'
48
+ sh "touch public/test.html" # for spec/features/record_editing_spec.rb
46
49
  end
47
50
  end
48
51
  end
49
52
 
53
+ desc "Run the spec tests"
50
54
  task :spec => :setup do
51
55
  here = File.expand_path("../", __FILE__)
52
56
  Dir.chdir(dummy) do
@@ -75,7 +75,13 @@ module RecordsControllerBehavior
75
75
 
76
76
  # Override this method if you want to set different metadata on the object
77
77
  def set_attributes
78
- @record.attributes = params[ActiveModel::Naming.singular(@record)]
78
+ @record.attributes = collect_form_attributes
79
+ end
80
+
81
+ def collect_form_attributes
82
+ attributes = params[ActiveModel::Naming.singular(@record)]
83
+ # removes attributes that were only changed by initialize_fields
84
+ attributes.reject { |key, value| @record[key].empty? and value == [""] }
79
85
  end
80
86
 
81
87
  # Override to redirect to an alternate location after create
@@ -1,5 +1,5 @@
1
1
  <h1><%= t('hydra_editor.choose_type.title') %></h1>
2
- <%= bootstrap_form_tag new_hydra_editor_record_path, :method => :get do |f| %>
2
+ <%= bootstrap_form_tag hydra_editor.new_record_path, :method => :get do |f| %>
3
3
  <%= bootstrap_select_tag :type, options_for_select(object_type_options) %>
4
4
  <%= bootstrap_actions do %>
5
5
  <%= bootstrap_submit_tag 'Next' %>
@@ -1,3 +1,3 @@
1
1
  module HydraEditor
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-22 00:00:00.000000000 Z
11
+ date: 2013-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails