storytime 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf39a31891a15bcee7b10824400ad71d55dada8c
4
- data.tar.gz: 6827ab5ce70be645b272de46062d7ceaf991f726
3
+ metadata.gz: 91d49457b192f13b7c8bcd673c56032d66391651
4
+ data.tar.gz: 0d86828ad2e793852463fa1ac999cb1aa0000d65
5
5
  SHA512:
6
- metadata.gz: c3f251310c2b7af9a815b214d7b42df3b458756db96df5868a959c0b43c2ea5f676d5c87f666401014388d9809ba9fe97d00760f2847bc44877af6436f943061
7
- data.tar.gz: 1cc0d64fee3ab5721d9a32c046a7f54cd211d7bee13de96d64c0da4ecee2f60643e227cffccf4e1155f34b631aa5d3ab9b5b163e4c0f07f582a68a5e95aaf315
6
+ metadata.gz: 2126e2e0e4b39b13e779683e21974382c9d8084791f8a4c6f0771739ab034405bada3235ab3856bd63ec96b141ad0e0e70767fc22b08ca07a0683e1267bde95a
7
+ data.tar.gz: 75a7c2fb54395a4e660d0a862b9dd29209bd862765108b5101c7502d4906a72e2a6faa3c0cf31884846354a265300775dab7c54a46e2c1696e70208ac3198b2a
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -43,7 +43,6 @@
43
43
  padding: 0;
44
44
  list-style: none;
45
45
  li {
46
- padding: 20px;
47
46
  border-bottom: 1px solid #ccc;
48
47
  border-left: 4px solid transparent;
49
48
  background: #fff;
@@ -52,6 +51,8 @@
52
51
  }
53
52
  a {
54
53
  text-decoration: none;
54
+ display: block;
55
+ padding: 20px;
55
56
  }
56
57
  &:hover {
57
58
  border-left: 4px solid #ccc;
@@ -24,7 +24,7 @@ module Storytime
24
24
  def show
25
25
  @post = if params[:preview]
26
26
  post = Post.find_preview(params[:id])
27
- # post.content = post.autosave.content if post.autosave
27
+ post.content = post.autosave.content
28
28
  post.preview = true
29
29
  post
30
30
  else
@@ -41,8 +41,8 @@ module Storytime
41
41
 
42
42
  @comments = @post.comments.order("created_at DESC")
43
43
  #allow overriding in the host app
44
- if lookup_context.template_exists?("storytime/posts/#{@post.slug}")
45
- render @post.slug
44
+ if lookup_context.template_exists?("storytime/#{@post.type_name.pluralize}/#{@post.slug}")
45
+ render "storytime/#{@post.type_name.pluralize}/#{@post.slug}"
46
46
  elsif lookup_context.template_exists?("storytime/#{@post.type_name.pluralize}/show")
47
47
  render "storytime/#{@post.type_name.pluralize}/show"
48
48
  end
@@ -0,0 +1,23 @@
1
+ require_dependency "storytime/application_controller"
2
+
3
+ module Storytime
4
+ class SubscriptionsController < ApplicationController
5
+ before_action :set_subscription, only: [:destroy]
6
+
7
+ def index
8
+ @subscriptions = Storytime::Subscription.all
9
+ render json: {subscriptions: @subscriptions}
10
+ end
11
+
12
+ def destroy
13
+
14
+ end
15
+
16
+ private
17
+
18
+ def set_subscription
19
+ binding.pry
20
+ @subscription = Storytime::Subscription.find_by(email: params[:email])
21
+ end
22
+ end
23
+ end
@@ -7,19 +7,14 @@
7
7
  <ul class="dashboard-list">
8
8
  <% @posts.each do |post| %>
9
9
  <li id="<%= post.class.to_s.downcase.split("::").last %>_<%= post.id %>" class="<%= 'active' if current_page?(url_for([:edit, :dashboard, post])) %>">
10
- <div class="row">
11
- <div class="col-md-8">
12
- <%= link_to post.title, [:edit, :dashboard, post], page_number: params[:page_number] %>
13
- </div>
14
- <div class="col-md-4">
15
- <span class="pull-right">
16
- <% unless post.published? %>
17
- <span class="label label-warning">Draft</span>
18
- <% end %>
19
- <%= delete_resource_link post, url_for([:dashboard, post]), !current_page?(url_for([:edit, :dashboard, post])) %>
20
- </span>
21
- </div>
22
- </div>
10
+ <%= link_to [:edit, :dashboard, post], page_number: params[:page_number] do %>
11
+ <%= post.title %>
12
+ <span class="pull-right">
13
+ <% unless post.published? %>
14
+ <span class="label label-warning">Draft</span>
15
+ <% end %>
16
+ </span>
17
+ <% end %>
23
18
  </li>
24
19
  <% end %>
25
20
  </ul>
@@ -4,6 +4,8 @@
4
4
  <%= f.input :content, as: :text, input_html: { rows: 20, class: "summernote" } %>
5
5
 
6
6
  <div class="actions">
7
+ <%= link_to "Delete", [:dashboard, @snippet], method: :delete, data: { confirm: t('common.are_you_sure_you_want_to_delete', resource_name: "Snippet") }, class: "btn btn-danger" unless @snippet.new_record? %>
8
+
7
9
  <div class="pull-right">
8
10
  <%= f.submit class: "btn #{@snippet.persisted? ? 'btn-default' : 'btn-primary'} save" %>
9
11
  </div>
@@ -10,16 +10,7 @@
10
10
  <ul class="dashboard-list">
11
11
  <% @snippets.each do |snippet| %>
12
12
  <li id="snippet_<%= snippet.id %>" class="<%= 'active' if current_page?(url_for([:edit, :dashboard, snippet])) %>">
13
- <div class="row">
14
- <div class="col-md-8">
15
- <%= link_to snippet.name, [:edit, :dashboard, snippet], page_number: params[:page_number] %>
16
- </div>
17
- <div class="col-md-4">
18
- <span class="pull-right">
19
- <%= delete_resource_link snippet, url_for([:dashboard, snippet]), !current_page?(url_for([:edit, :dashboard, snippet])) %>
20
- </span>
21
- </div>
22
- </div>
13
+ <%= link_to snippet.name, [:edit, :dashboard, snippet], page_number: params[:page_number] %>
23
14
  </li>
24
15
  <% end %>
25
16
  </ul>
@@ -9,17 +9,14 @@ inputs = %w[
9
9
  StringInput
10
10
  TextInput
11
11
  ]
12
-
12
+
13
13
  inputs.each do |input_type|
14
- superclass = "SimpleForm::Inputs::#{input_type}".constantize
15
-
16
- new_class = Class.new(superclass) do
17
- def input_html_classes
18
- super.push('form-control')
14
+ "SimpleForm::Inputs::#{input_type}".constantize.class_eval do
15
+ alias_method :__input_html_classes, :input_html_classes
16
+ define_method(:input_html_classes) do
17
+ __input_html_classes.push('form-control')
19
18
  end
20
19
  end
21
-
22
- Object.const_set(input_type, new_class)
23
20
  end
24
21
 
25
22
  # Use this setup block to configure all options available in SimpleForm.
@@ -1,3 +1,3 @@
1
1
  module Storytime
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
Binary file
Binary file
@@ -64,15 +64,17 @@ describe "In the dashboard, Pages" do
64
64
 
65
65
  it "deletes a page", js: true do
66
66
  3.times{|i| FactoryGirl.create(:page) }
67
- visit url_for([:dashboard, Storytime::Post, type: Storytime::Page.type_name, only_path: true])
68
- p1 = Storytime::Page.first
69
- p2 = Storytime::Page.last
70
- click_link("delete_page_#{p1.id}")
67
+ expect(Storytime::Page.count).to eq(3)
71
68
 
72
- page.should_not have_content(p1.title)
73
- page.should have_content(p2.title)
69
+ storytime_page = Storytime::Page.first
70
+ visit url_for([:edit, :dashboard, storytime_page, type: Storytime::Page.type_name, only_path: true])
71
+
72
+ click_link "Delete"
73
+
74
+ expect { storytime_page.reload }.to raise_error
74
75
 
75
- expect{ p1.reload }.to raise_error
76
+ expect(page).to_not have_content(storytime_page.title)
77
+ expect(Storytime::Page.count).to eq(2)
76
78
  end
77
79
 
78
80
  end
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'pry'
2
+
3
3
  describe "In the dashboard, Posts" do
4
4
  before{ login_admin }
5
5
 
@@ -48,6 +48,7 @@ describe "In the dashboard, Posts" do
48
48
  fill_in "post_title", with: "Snow Crash"
49
49
  fill_in "post_excerpt", with: "The Deliverator belongs to an elite order, a hallowed sub-category."
50
50
 
51
+ # Use find(".note-editable").set instead of fill_in "post_draft_content" because of Summernote (js)
51
52
  find(".note-editable").set "The Deliverator belongs to an elite order, a hallowed sub-category."
52
53
  click_button "Preview"
53
54
 
@@ -105,16 +106,17 @@ describe "In the dashboard, Posts" do
105
106
 
106
107
  it "deletes a post", js: true do
107
108
  3.times{|i| FactoryGirl.create(:post) }
108
- visit url_for([:dashboard, Storytime::BlogPost, only_path: true])
109
- p1 = Storytime::BlogPost.first
110
- p2 = Storytime::BlogPost.last
109
+ expect(Storytime::BlogPost.count).to eq(3)
110
+
111
+ post = Storytime::BlogPost.first
112
+ visit url_for([:edit, :dashboard, post, only_path: true])
111
113
 
112
- click_link("delete_blogpost_#{p1.id}")
114
+ click_link "Delete"
113
115
 
114
- page.should_not have_content(p1.title)
115
- page.should have_content(p2.title)
116
+ expect { post.reload }.to raise_error
116
117
 
117
- expect{ p1.reload }.to raise_error
118
+ expect(page).to_not have_content(post.title)
119
+ expect(Storytime::Post.count).to eq(2)
118
120
  end
119
121
 
120
122
  end
@@ -49,17 +49,19 @@ describe "In the dashboard, Snippets" do
49
49
  expect(snippet.content).to eq("It was a dark and stormy night...")
50
50
  end
51
51
 
52
- it "deletes a snippet", js: true do
52
+ it "deletes a snippet" do
53
53
  3.times{|i| FactoryGirl.create(:snippet) }
54
- visit url_for([:dashboard, Storytime::Snippet, only_path: true])
55
- s1 = Storytime::Snippet.first
56
- s2 = Storytime::Snippet.last
57
- click_link("delete_snippet_#{s1.id}")
54
+ expect(Storytime::Snippet.count).to eq(3)
58
55
 
59
- expect(page).to_not have_content(s1.name)
60
- expect(page).to have_content(s2.name)
56
+ snippet = Storytime::Snippet.first
57
+ visit url_for([:edit, :dashboard, snippet, only_path: true])
61
58
 
62
- expect{ s1.reload }.to raise_error
59
+ click_link "Delete"
60
+
61
+ expect { snippet.reload }.to raise_error
62
+
63
+ expect(page).to_not have_content(snippet.name)
64
+ expect(Storytime::Snippet.count).to eq(2)
63
65
  end
64
66
 
65
67
  end
@@ -10,7 +10,7 @@
10
10
  # visit url_for([:dashboard, Storytime::Subscription])
11
11
 
12
12
  # Storytime::Subscription.all.each do |s|
13
- # expect(page).to have_link("Edit", href: url_for([:edit, :dashboard, s, only_path: true]))
13
+ # expect(page).to have_link("Edit", href: url_for([:edit, :dashboard, s]))
14
14
  # end
15
15
  # end
16
16
 
@@ -60,6 +60,4 @@
60
60
  # expect(page).to have_content(I18n.t('dashboard.subscriptions.unsubscribe.message'))
61
61
  # end
62
62
  # end
63
-
64
- # it
65
63
  # end
@@ -0,0 +1,19 @@
1
+ # require 'spec_helper'
2
+
3
+ # describe "Subscriptions" do
4
+ # before do
5
+ # setup_site
6
+ # end
7
+
8
+ # it "allows users to subscribe to a site" do
9
+ # pending "test if user can find a link to subscribe, click the link, enter their email, and then get a confirmation"
10
+ # end
11
+
12
+ # it "allows users to unsubscribe from a site through a link" do
13
+ # pending "test if user can goto a link and unsubscribe from a site"
14
+ # end
15
+
16
+ # it "only allows users to unsubscribe with a proper token" do
17
+ # pending "test if user can unsubscribe with incorrect token"
18
+ # end
19
+ # end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: storytime
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Roesch, David Van Der Beek, Brandon Robins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-03 00:00:00.000000000 Z
11
+ date: 2015-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -474,6 +474,7 @@ files:
474
474
  - app/assets/javascripts/storytime/posts.js.coffee
475
475
  - app/assets/javascripts/storytime/sites.js.coffee
476
476
  - app/assets/javascripts/storytime/snippets.js.coffee
477
+ - app/assets/javascripts/storytime/subscriptions.js
477
478
  - app/assets/javascripts/storytime/utilities.js
478
479
  - app/assets/stylesheets/storytime/admin.css.scss
479
480
  - app/assets/stylesheets/storytime/application.css.scss
@@ -497,6 +498,7 @@ files:
497
498
  - app/controllers/storytime/dashboard_controller.rb
498
499
  - app/controllers/storytime/pages_controller.rb
499
500
  - app/controllers/storytime/posts_controller.rb
501
+ - app/controllers/storytime/subscriptions_controller.rb
500
502
  - app/helpers/storytime/application_helper.rb
501
503
  - app/helpers/storytime/dashboard/autosaves_helper.rb
502
504
  - app/helpers/storytime/dashboard/media_helper.rb
@@ -683,6 +685,7 @@ files:
683
685
  - spec/features/dashboard/users_spec.rb
684
686
  - spec/features/pages_spec.rb
685
687
  - spec/features/posts_spec.rb
688
+ - spec/features/subscription_spec.rb
686
689
  - spec/importers/wordpress_spec.rb
687
690
  - spec/lib/storytime_spec.rb
688
691
  - spec/models/post_spec.rb
@@ -800,6 +803,7 @@ test_files:
800
803
  - spec/features/dashboard/users_spec.rb
801
804
  - spec/features/pages_spec.rb
802
805
  - spec/features/posts_spec.rb
806
+ - spec/features/subscription_spec.rb
803
807
  - spec/importers/wordpress_spec.rb
804
808
  - spec/lib/storytime_spec.rb
805
809
  - spec/models/post_spec.rb