aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/assets/images/refinery/blog/icons/add.pngbin733 -> 0 bytes
-rw-r--r--app/assets/images/refinery/blog/icons/cog.pngbin512 -> 0 bytes
-rw-r--r--app/assets/images/refinery/blog/icons/comment.pngbin413 -> 0 bytes
-rw-r--r--app/assets/images/refinery/blog/icons/comment_cross.pngbin1507 -> 0 bytes
-rw-r--r--app/assets/images/refinery/blog/icons/comment_tick.pngbin1524 -> 0 bytes
-rw-r--r--app/assets/images/refinery/blog/icons/comments.pngbin557 -> 0 bytes
-rw-r--r--app/assets/images/refinery/blog/icons/down.gifbin110 -> 0 bytes
-rw-r--r--app/assets/images/refinery/blog/icons/folder.pngbin537 -> 0 bytes
-rw-r--r--app/assets/images/refinery/blog/icons/folder_add.pngbin668 -> 0 bytes
-rw-r--r--app/assets/images/refinery/blog/icons/folder_edit.pngbin733 -> 0 bytes
-rw-r--r--app/assets/images/refinery/blog/icons/page.pngbin635 -> 0 bytes
-rw-r--r--app/assets/images/refinery/blog/icons/page_add.pngbin739 -> 0 bytes
-rw-r--r--app/assets/images/refinery/blog/icons/page_copy.pngbin663 -> 0 bytes
-rw-r--r--app/assets/images/refinery/blog/icons/up.gifbin111 -> 0 bytes
-rw-r--r--app/assets/javascripts/refinery/blog/backend.js2
-rw-r--r--app/assets/stylesheets/refinery/blog/backend.css.scss57
-rw-r--r--app/views/refinery/blog/admin/_submenu.html.erb4
-rw-r--r--app/views/refinery/blog/admin/posts/_form.html.erb6
-rw-r--r--lib/refinery/blog/engine.rb5
-rw-r--r--spec/features/refinery/blog/admin/posts_spec.rb32
-rw-r--r--spec/features/refinery/blog/posts_spec.rb38
21 files changed, 44 insertions, 100 deletions
diff --git a/app/assets/images/refinery/blog/icons/add.png b/app/assets/images/refinery/blog/icons/add.png
deleted file mode 100644
index 6332fef..0000000
--- a/app/assets/images/refinery/blog/icons/add.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/refinery/blog/icons/cog.png b/app/assets/images/refinery/blog/icons/cog.png
deleted file mode 100644
index 67de2c6..0000000
--- a/app/assets/images/refinery/blog/icons/cog.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/refinery/blog/icons/comment.png b/app/assets/images/refinery/blog/icons/comment.png
deleted file mode 100644
index 7bc9233..0000000
--- a/app/assets/images/refinery/blog/icons/comment.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/refinery/blog/icons/comment_cross.png b/app/assets/images/refinery/blog/icons/comment_cross.png
deleted file mode 100644
index 6f8102d..0000000
--- a/app/assets/images/refinery/blog/icons/comment_cross.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/refinery/blog/icons/comment_tick.png b/app/assets/images/refinery/blog/icons/comment_tick.png
deleted file mode 100644
index bcb3ae4..0000000
--- a/app/assets/images/refinery/blog/icons/comment_tick.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/refinery/blog/icons/comments.png b/app/assets/images/refinery/blog/icons/comments.png
deleted file mode 100644
index 39433cf..0000000
--- a/app/assets/images/refinery/blog/icons/comments.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/refinery/blog/icons/down.gif b/app/assets/images/refinery/blog/icons/down.gif
deleted file mode 100644
index 990bd87..0000000
--- a/app/assets/images/refinery/blog/icons/down.gif
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/refinery/blog/icons/folder.png b/app/assets/images/refinery/blog/icons/folder.png
deleted file mode 100644
index 784e8fa..0000000
--- a/app/assets/images/refinery/blog/icons/folder.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/refinery/blog/icons/folder_add.png b/app/assets/images/refinery/blog/icons/folder_add.png
deleted file mode 100644
index 529fe8f..0000000
--- a/app/assets/images/refinery/blog/icons/folder_add.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/refinery/blog/icons/folder_edit.png b/app/assets/images/refinery/blog/icons/folder_edit.png
deleted file mode 100644
index ad669cc..0000000
--- a/app/assets/images/refinery/blog/icons/folder_edit.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/refinery/blog/icons/page.png b/app/assets/images/refinery/blog/icons/page.png
deleted file mode 100644
index 03ddd79..0000000
--- a/app/assets/images/refinery/blog/icons/page.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/refinery/blog/icons/page_add.png b/app/assets/images/refinery/blog/icons/page_add.png
deleted file mode 100644
index d5bfa07..0000000
--- a/app/assets/images/refinery/blog/icons/page_add.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/refinery/blog/icons/page_copy.png b/app/assets/images/refinery/blog/icons/page_copy.png
deleted file mode 100644
index 195dc6d..0000000
--- a/app/assets/images/refinery/blog/icons/page_copy.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/refinery/blog/icons/up.gif b/app/assets/images/refinery/blog/icons/up.gif
deleted file mode 100644
index 1edf617..0000000
--- a/app/assets/images/refinery/blog/icons/up.gif
+++ /dev/null
Binary files differ
diff --git a/app/assets/javascripts/refinery/blog/backend.js b/app/assets/javascripts/refinery/blog/backend.js
index f27f837..ee9313a 100644
--- a/app/assets/javascripts/refinery/blog/backend.js
+++ b/app/assets/javascripts/refinery/blog/backend.js
@@ -1,6 +1,8 @@
//= require jquery-ui/autocomplete
$(document).ready(function(){
+ $('#more_options').hide()
+
$('nav#actions.multilist > ul:not(.search_list) li a[href$="' + window.location.pathname + '"]')
.parent().addClass('selected');
if($('nav#actions.multilist > ul:not(.search_list) li.selected').length == 0) {
diff --git a/app/assets/stylesheets/refinery/blog/backend.css.scss b/app/assets/stylesheets/refinery/blog/backend.css.scss
index e4ff700..5bfe203 100644
--- a/app/assets/stylesheets/refinery/blog/backend.css.scss
+++ b/app/assets/stylesheets/refinery/blog/backend.css.scss
@@ -1,58 +1,3 @@
-.comments_icon {
- background-image: image_url('refinery/blog/icons/comments.png');
-}
-.comment_icon {
- background-image: image_url('refinery/blog/icons/comment.png');
-}
-.comment_cross_icon {
- background-image: image_url('refinery/blog/icons/comment_cross.png');
-}
-.comment_tick_icon {
- background-image: image_url('refinery/blog/icons/comment_tick.png');
-}
-.folder_icon {
- background-image: image_url('refinery/blog/icons/folder.png');
-}
-.folder_add_icon {
- background-image: image_url('refinery/blog/icons/folder_add.png');
-}
-.folder_edit_icon {
- background-image: image_url('refinery/blog/icons/folder_edit.png');
-}
-.settings_icon {
- background-image: image_url('refinery/blog/icons/cog.png');
-}
-.page_icon {
- background-image: image_url('refinery/blog/icons/page.png');
-}
-.page_copy_icon {
- background-image: image_url('refinery/blog/icons/page_copy.png');
-}
-.page_add_icon {
- background-image: image_url('refinery/blog/icons/page_add.png');
-}
-ul.collapsible_menu li {
- position: relative;
- span.arrow {
- background-repeat: no-repeat;
- position: absolute;
- right: 10px;
- top: 13px;
- width: 11px;
- height: 7px;
- cursor: pointer;
- background-image: image_url('refinery/blog/icons/up.gif');
- }
- &.closed {
- span.arrow {
- background-image: image_url('refinery/blog/icons/down.gif');
- }
- }
- > div {
- width: 93%;
- margin: 0px auto;
- }
-}
ul.blog_categories {
height:200px;
overflow:auto;
@@ -74,4 +19,4 @@ a#copy_body_link {
.form-actions a.confirm-delete, #content .form-actions a.confirm-delete {
position: relative;
right: auto;
-} \ No newline at end of file
+}
diff --git a/app/views/refinery/blog/admin/_submenu.html.erb b/app/views/refinery/blog/admin/_submenu.html.erb
index 03426b7..5f67405 100644
--- a/app/views/refinery/blog/admin/_submenu.html.erb
+++ b/app/views/refinery/blog/admin/_submenu.html.erb
@@ -1,8 +1,6 @@
<nav id='actions' class='multilist'>
<ul class='search_list'>
- <li class='not_a_link'>
- <%= render "/refinery/admin/search", :url => request.path %>
- </li>
+ <li class='not_a_link'><%= render "/refinery/admin/search", :url => request.path -%></li>
</ul>
<ul class='collapsible_menu'>
diff --git a/app/views/refinery/blog/admin/posts/_form.html.erb b/app/views/refinery/blog/admin/posts/_form.html.erb
index 5cb061e..26b9f78 100644
--- a/app/views/refinery/blog/admin/posts/_form.html.erb
+++ b/app/views/refinery/blog/admin/posts/_form.html.erb
@@ -40,14 +40,14 @@
</div>
</div>
- <%= render '/refinery/admin/form_advanced_options_menu', :f => f %>
-
<div class='field'>
<%= f.label :tag_list, t('refinery.blog.shared.tags.title') -%>
<%= f.text_field :tag_list, value: @post.tag_list.to_s, :class => 'larger' -%>
</div>
- <div id='more_options' style="display:none;">
+ <%= render '/refinery/admin/form_advanced_options_menu', :f => f %>
+
+ <div id='more_options'>
<div class="hemisquare">
<h3><%= t('title', :scope => 'refinery.blog.admin.submenu.categories') %></h3>
<ul class='blog_categories'>
diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb
index c4c39d8..cc0d59a 100644
--- a/lib/refinery/blog/engine.rb
+++ b/lib/refinery/blog/engine.rb
@@ -12,6 +12,11 @@ module Refinery
plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.blog_admin_posts_path }
plugin.menu_match = %r{refinery/blog/?(posts|comments|categories)?}
end
+
+ Rails.application.config.assets.precompile += %w(
+ refinery/blog/backend.css
+ refinery/blog/**/*.css
+ )
end
config.after_initialize do
diff --git a/spec/features/refinery/blog/admin/posts_spec.rb b/spec/features/refinery/blog/admin/posts_spec.rb
index 2c7b82c..0efbb1d 100644
--- a/spec/features/refinery/blog/admin/posts_spec.rb
+++ b/spec/features/refinery/blog/admin/posts_spec.rb
@@ -32,27 +32,24 @@ module Refinery
expect(page).to have_content("Tags")
end
- it "should have category title", :js => true do
- click_link "toggle_advanced_options"
+ it "should have category title" do
expect(page).to have_content(blog_category.title)
end
- describe "create blog post", :js => true do
+ describe "create blog post" do
before do
expect(subject.class.count).to eq(0)
fill_in "post_title", :with => "This is my blog post"
+ fill_in "post_body", with: "<p>And I love it</p>"
- # this is a dirty hack but textarea that needs to be filled is
- # hidden and capybara refuses to fill in elements it can't see
- page.evaluate_script("WYMeditor.INSTANCES[0].html('<p>And I love it</p>')")
- click_link "toggle_advanced_options"
- sleep 1
expect(page).to have_css '.blog_categories'
expect(page).to have_css "#post_category_ids_#{blog_category.id}"
- expect(page).to have_selector("#post_category_ids_#{blog_category.id}:not(:checked)")
- check blog_category.title
- expect(page).to have_selector("#post_category_ids_#{blog_category.id}:checked")
+ expect { check(blog_category.title) }.to change {
+ !!page.find("#post_category_ids_#{blog_category.id}").checked?
+ }.from(false).to(true)
+
click_button "Save"
+
expect(page).to have_content("was successfully added.")
end
@@ -70,13 +67,11 @@ module Refinery
end
end
- describe "create blog post with tags", :js => true do
+ describe "create blog post with tags" do
let(:tag_list) { "chicago, bikes, beers, babes" }
before do
fill_in "Title", :with => "This is a tagged blog post"
- # this is a dirty hack but textarea that needs to be filled is
- # hidden and capybara refuses to fill in elements it can't see
- page.evaluate_script("WYMeditor.INSTANCES[0].html('<p>And I also love it</p>')")
+ fill_in "post_body", with: "<p>And I also love it</p>"
fill_in "Tags", :with => tag_list
click_button "Save"
end
@@ -160,17 +155,14 @@ module Refinery
context "with multiple users" do
let!(:other_guy) { FactoryGirl.create(:refinery_user, :username => "Other Guy") }
- describe "create blog post with alternate author", :js => true do
+ describe "create blog post with alternate author" do
before do
visit refinery.blog_admin_posts_path
click_link "Create new post"
fill_in "post_title", :with => "This is some other guy's blog post"
- # this is a dpage_titleirty hack but textarea that needs to be filled is
- # hidden and capybara refuses to fill in elements it can't see
- page.evaluate_script("WYMeditor.INSTANCES[0].html('<p>I totally did not write it.</p>')")
+ fill_in "post_body", with: "<p>I totally did not write it.</p>"
- click_link "toggle_advanced_options"
expect(page).to have_content("Author")
select other_guy.username, :from => "Author"
diff --git a/spec/features/refinery/blog/posts_spec.rb b/spec/features/refinery/blog/posts_spec.rb
index a96b63a..3382398 100644
--- a/spec/features/refinery/blog/posts_spec.rb
+++ b/spec/features/refinery/blog/posts_spec.rb
@@ -41,25 +41,27 @@ module Refinery
describe "list tagged posts" do
context "when has tagged blog posts" do
- before do
- @tag_name = "chicago"
- @post = FactoryGirl.create(:blog_post,
- :title => "I Love my city",
- :tag_list => @tag_name)
- @tag = ::Refinery::Blog::Post.tag_counts_on(:tags).first
- end
+ let!(:tag_name) { "chicago" }
+ let!(:post) {
+ FactoryGirl.create(:blog_post,
+ :title => "I Love my city",
+ :tag_list => tag_name
+ )
+ }
+ let!(:tag) { ::Refinery::Blog::Post.tag_counts_on(:tags).first }
+
it "should have one tagged post" do
- visit refinery.blog_tagged_posts_path(@tag.id, @tag_name.parameterize)
+ visit refinery.blog_tagged_posts_path(tag.id, tag_name.parameterize)
- expect(page).to have_content(@tag_name)
- expect(page).to have_content(@post.title)
+ expect(page).to have_content(tag_name)
+ expect(page).to have_content(post.title)
end
end
end
describe "#show" do
context "when has no comments" do
- let(:blog_post) { FactoryGirl.create(:blog_post) }
+ let!(:blog_post) { FactoryGirl.create(:blog_post) }
it "should display the blog post" do
visit refinery.blog_post_path(blog_post)
@@ -68,7 +70,7 @@ module Refinery
end
end
context "when has approved comments" do
- let(:approved_comment) { FactoryGirl.create(:approved_comment) }
+ let!(:approved_comment) { FactoryGirl.create(:approved_comment) }
it "should display the comments" do
visit refinery.blog_post_path(approved_comment.post)
@@ -78,7 +80,7 @@ module Refinery
end
end
context "when has rejected comments" do
- let(:rejected_comment) { FactoryGirl.create(:rejected_comment) }
+ let!(:rejected_comment) { FactoryGirl.create(:rejected_comment) }
it "should not display the comments" do
visit refinery.blog_post_path(rejected_comment.post)
@@ -87,7 +89,7 @@ module Refinery
end
end
context "when has new comments" do
- let(:blog_comment) { FactoryGirl.create(:blog_comment) }
+ let!(:blog_comment) { FactoryGirl.create(:blog_comment) }
it "should not display the comments" do
visit refinery.blog_post_path(blog_comment.post)
@@ -97,7 +99,7 @@ module Refinery
end
context "when posting comments" do
- let(:blog_post) { FactoryGirl.create(:blog_post) }
+ let!(:blog_post) { FactoryGirl.create(:blog_post) }
let(:name) { "pete" }
let(:email) { "pete@mcawesome.com" }
let(:body) { "Witty comment." }
@@ -121,8 +123,8 @@ module Refinery
end
context "post popular" do
- let(:blog_post) { FactoryGirl.create(:blog_post) }
- let(:blog_post2) { FactoryGirl.create(:blog_post) }
+ let!(:blog_post) { FactoryGirl.create(:blog_post) }
+ let!(:blog_post2) { FactoryGirl.create(:blog_post) }
before do
visit refinery.blog_post_path(blog_post)
@@ -151,7 +153,7 @@ module Refinery
end
describe "#show draft preview" do
- let(:blog_post) { FactoryGirl.create(:blog_post_draft) }
+ let!(:blog_post) { FactoryGirl.create(:blog_post_draft) }
context "when logged in as admin" do
it "should display the draft notification" do