Skip to content

Commit

Permalink
Merge pull request #47 from spartansystems/fix_named_input
Browse files Browse the repository at this point in the history
Fix named input
  • Loading branch information
Mrjaco12 committed Nov 6, 2015
2 parents 0e75de3 + 033e0b4 commit 1214081
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 22 deletions.
12 changes: 5 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
PATH
remote: .
specs:
atomic_cms (0.0.1)
atomic_cms (0.2.2)
activeadmin (= 1.0.0.pre2)
angularjs-rails (~> 1.3, < 1.4)
atomic_assets (~> 0.0.4)
atomic_assets (~> 0.1.0)
jquery-rails (~> 4.0, >= 4.0.3)
paperclip (~> 4.3)
rails (~> 4.2)
Expand Down Expand Up @@ -62,13 +61,12 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
angularjs-rails (1.3.15)
arbre (1.0.3)
activesupport (>= 3.0.0)
arel (6.0.3)
atomic_assets (0.0.4)
atomic_assets (0.1.0)
draper (~> 2.1)
bourbon (4.2.5)
bourbon (4.2.6)
sass (~> 3.4)
thor (~> 0.19)
builder (3.2.2)
Expand Down Expand Up @@ -193,7 +191,7 @@ GEM
rspec-mocks (~> 3.3.0)
rspec-support (~> 3.3.0)
rspec-support (3.3.0)
sass (3.4.18)
sass (3.4.19)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
Expand Down
9 changes: 5 additions & 4 deletions app/assets/javascripts/atomic_cms.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,14 @@

$editor.find('.add-children-sublist-item').each(function() {
var $input = $(this);
$input.attr('name', null).val('');
var $componentInput = $input.siblings('.children-sublist');
$componentInput.attr('name', null).val('');
$input.click(function(e) {
e.preventDefault();
var component = $(this).siblings('.children-sublist').val();
if (component !== ''){
var componentPath = $componentInput.val();
if (componentPath !== ''){
$scope.$broadcast('append', {
href: component
href: componentPath
});
}
});
Expand Down
4 changes: 2 additions & 2 deletions atomic_cms.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Gem::Specification.new do |s|
s.date = '2015-06-19'
s.summary = 'Atomic CMS'
s.description = 'Live CMS powered by atomic assets.'
s.authors = ['Don Humphreys']
s.email = '[email protected]'
s.authors = ['Don Humphreys', 'Spartan']
s.email = '[email protected]'
s.files = `git ls-files`.split(/\n/)
s.test_files = Dir['spec/**/*']
# s.homepage = 'http://rubygems.org/gems/atomic_cms'
Expand Down
23 changes: 15 additions & 8 deletions spec/controllers/media_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
require 'rails_helper'
require "rails_helper"

RSpec.describe AtomicCms::MediaController, type: :controller do
it 'accepts a post request and fails with bad data' do
scrubber = double('scrubber')
# Previously the engines guide contained an incorrect example that
# recommended using the `use_route` option to test an engine's controllers
# within the dummy application. That recommendation was incorrect and has
# since been corrected. Instead, you should override the `@routes` variable
# in the test case with `Foo::Engine.routes`.
before { @routes = AtomicCms::Engine.routes }

it "accepts a post request and fails with bad data" do
scrubber = double("scrubber")
allow(MediaScrubber).to receive(:new).and_return(scrubber)
allow(scrubber).to receive(:save).and_return(false)

post :create, use_route: :atomic_cms, file: double('file')
post :create, file: double("file")

expect(response).to have_http_status(:unprocessable_entity)
end

it 'accepts a post with an image' do
scrubber = double('scrubber', save: true, url: 'http://www.google.com')
it "accepts a post with an image" do
scrubber = double("scrubber", save: true, url: "http://www.google.com")
expect(MediaScrubber).to receive(:new).and_return(scrubber)

post :create, use_route: :atomic_cms, file: double('file')
post :create, file: double("file")

expect(response).to have_http_status(:created)
expect(response.body).to include('http://www.google.com')
expect(response.body).to include("http://www.google.com")
end
end
1 change: 0 additions & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'spec_helper'
require 'rspec/rails'
require 'rspec/autorun'
require 'factory_girl_rails'
require 'shoulda/matchers'
require 'paperclip/matchers'
Expand Down

0 comments on commit 1214081

Please sign in to comment.