spree_news 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +0 -8
- data/Gemfile.lock +119 -105
- data/README.md +20 -10
- data/app/assets/javascripts/backend/spree_news.js +1 -0
- data/app/assets/javascripts/{store → frontend}/spree_news.js +1 -1
- data/app/assets/stylesheets/{admin → backend}/spree_news.css +1 -1
- data/app/assets/stylesheets/frontend/spree_news.css +4 -0
- data/app/controllers/spree/admin/posts_controller.rb +10 -2
- data/app/controllers/spree/posts_controller.rb +13 -0
- data/app/models/spree/post.rb +2 -2
- data/app/overrides/spree_news_overrides.rb +2 -2
- data/app/views/shared/_news.html.erb +31 -0
- data/app/views/spree/admin/posts/_form.html.erb +7 -0
- data/app/views/spree/admin/posts/edit.html.erb +7 -0
- data/app/views/spree/admin/posts/index.html.erb +30 -0
- data/app/views/spree/admin/posts/new.html.erb +8 -0
- data/app/views/spree/admin/posts/show.html.erb +15 -0
- data/app/views/spree/posts/index.html.erb +17 -0
- data/app/views/spree/posts/show.html.erb +11 -0
- data/config/locales/en.yml +11 -0
- data/config/locales/ru.yml +16 -0
- data/config/routes.rb +1 -0
- data/db/migrate/20120312183513_create_posts.rb +1 -1
- data/lib/generators/spree_news/install/install_generator.rb +4 -4
- data/spree_news.gemspec +2 -5
- metadata +29 -54
- data/app/assets/javascripts/admin/spree_news.js +0 -2
- data/app/assets/stylesheets/store/spree_news.css +0 -4
- data/app/views/shared/_news.html.haml +0 -22
- data/app/views/spree/admin/posts/_form.html.haml +0 -13
- data/app/views/spree/admin/posts/edit.html.haml +0 -6
- data/app/views/spree/admin/posts/index.html.haml +0 -18
- data/app/views/spree/admin/posts/new.html.haml +0 -6
- data/app/views/spree/admin/posts/show.html.haml +0 -11
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2d393ffa2bbe7a29eaa907c025be21c52ca5398d
|
4
|
+
data.tar.gz: e68cb9b393383d20aa764f504323fce99bbfb8b6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 382fdf07a14ea8416eb075477c5352ab0ae8c7266ce483c17e2bd6dc0eb56f24f7b4b5af5e6fa57cb79ff68f37154557ed90d82130d6bb5726a0f6b1ef56b66d
|
7
|
+
data.tar.gz: 76f6b9a4f6036e9c09f61edd605b1666f785643394807eacd363d97e59f13cd21e2e68993db5c3a86aecf67e9bdf8e491e18fc9f53b417c5aae64bc0bfc35104
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,130 +1,135 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
spree_news (0.0.
|
5
|
-
haml
|
6
|
-
spree_core (~>
|
4
|
+
spree_news (0.0.5)
|
5
|
+
haml (~> 3.1.4)
|
6
|
+
spree_core (~> 2.0.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actionmailer (3.
|
12
|
-
actionpack (= 3.
|
13
|
-
mail (~> 2.3
|
14
|
-
actionpack (3.
|
15
|
-
activemodel (= 3.
|
16
|
-
activesupport (= 3.
|
11
|
+
actionmailer (3.2.13)
|
12
|
+
actionpack (= 3.2.13)
|
13
|
+
mail (~> 2.5.3)
|
14
|
+
actionpack (3.2.13)
|
15
|
+
activemodel (= 3.2.13)
|
16
|
+
activesupport (= 3.2.13)
|
17
17
|
builder (~> 3.0.0)
|
18
18
|
erubis (~> 2.7.0)
|
19
|
-
|
20
|
-
rack (~> 1.
|
21
|
-
rack-cache (~> 1.
|
22
|
-
rack-mount (~> 0.8.2)
|
19
|
+
journey (~> 1.0.4)
|
20
|
+
rack (~> 1.4.5)
|
21
|
+
rack-cache (~> 1.2)
|
23
22
|
rack-test (~> 0.6.1)
|
24
|
-
sprockets (~> 2.
|
25
|
-
active_utils (1.0.
|
23
|
+
sprockets (~> 2.2.1)
|
24
|
+
active_utils (1.0.5)
|
26
25
|
activesupport (>= 2.3.11)
|
27
26
|
i18n
|
28
|
-
activemerchant (1.
|
29
|
-
active_utils (>= 1.0.
|
30
|
-
activesupport (>= 2.3.
|
31
|
-
braintree (>= 2.0.0)
|
27
|
+
activemerchant (1.34.1)
|
28
|
+
active_utils (>= 1.0.2)
|
29
|
+
activesupport (>= 2.3.14)
|
32
30
|
builder (>= 2.0.0)
|
33
31
|
i18n
|
34
32
|
json (>= 1.5.1)
|
35
|
-
money
|
36
|
-
|
37
|
-
|
33
|
+
money
|
34
|
+
nokogiri (< 1.6.0)
|
35
|
+
activemodel (3.2.13)
|
36
|
+
activesupport (= 3.2.13)
|
38
37
|
builder (~> 3.0.0)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
arel (~> 2.2.1)
|
38
|
+
activerecord (3.2.13)
|
39
|
+
activemodel (= 3.2.13)
|
40
|
+
activesupport (= 3.2.13)
|
41
|
+
arel (~> 3.0.2)
|
44
42
|
tzinfo (~> 0.3.29)
|
45
|
-
activeresource (3.
|
46
|
-
activemodel (= 3.
|
47
|
-
activesupport (= 3.
|
48
|
-
activesupport (3.
|
43
|
+
activeresource (3.2.13)
|
44
|
+
activemodel (= 3.2.13)
|
45
|
+
activesupport (= 3.2.13)
|
46
|
+
activesupport (3.2.13)
|
47
|
+
i18n (= 0.6.1)
|
49
48
|
multi_json (~> 1.0)
|
50
|
-
acts_as_list (0.
|
49
|
+
acts_as_list (0.2.0)
|
50
|
+
activerecord (>= 3.0)
|
51
51
|
archive-tar-minitar (0.5.2)
|
52
|
-
arel (
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
arel (3.0.2)
|
53
|
+
awesome_nested_set (2.1.5)
|
54
|
+
activerecord (>= 3.0.0)
|
55
|
+
aws-sdk (1.3.9)
|
56
|
+
httparty (~> 0.7)
|
57
|
+
json (~> 1.4)
|
58
|
+
nokogiri (>= 1.4.4)
|
59
|
+
uuidtools (~> 2.1)
|
60
|
+
builder (3.0.4)
|
61
|
+
cancan (1.6.8)
|
62
|
+
climate_control (0.0.3)
|
63
|
+
activesupport (>= 3.0)
|
64
|
+
cocaine (0.5.1)
|
65
|
+
climate_control (>= 0.0.3, < 1.0)
|
57
66
|
columnize (0.3.6)
|
58
|
-
deface (0.
|
67
|
+
deface (0.9.1)
|
59
68
|
nokogiri (~> 1.5.0)
|
60
|
-
rails (
|
69
|
+
rails (~> 3.1)
|
61
70
|
erubis (2.7.0)
|
62
|
-
ffaker (1.
|
63
|
-
haml (3.1.
|
64
|
-
highline (1.6.
|
65
|
-
hike (1.2.
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
+
ffaker (1.16.1)
|
72
|
+
haml (3.1.8)
|
73
|
+
highline (1.6.18)
|
74
|
+
hike (1.2.3)
|
75
|
+
httparty (0.11.0)
|
76
|
+
multi_json (~> 1.0)
|
77
|
+
multi_xml (>= 0.5.2)
|
78
|
+
i18n (0.6.1)
|
79
|
+
journey (1.0.4)
|
80
|
+
json (1.8.0)
|
71
81
|
kaminari (0.13.0)
|
72
82
|
actionpack (>= 3.0.0)
|
73
83
|
activesupport (>= 3.0.0)
|
74
84
|
railties (>= 3.0.0)
|
75
85
|
linecache19 (0.5.12)
|
76
86
|
ruby_core_source (>= 0.1.4)
|
77
|
-
mail (2.
|
78
|
-
i18n (>= 0.4.0)
|
87
|
+
mail (2.5.4)
|
79
88
|
mime-types (~> 1.16)
|
80
89
|
treetop (~> 1.4.8)
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
multi_json (1.1.0)
|
90
|
-
nested_set (1.6.8)
|
90
|
+
mime-types (1.23)
|
91
|
+
money (5.1.1)
|
92
|
+
i18n (~> 0.6.0)
|
93
|
+
multi_json (1.7.7)
|
94
|
+
multi_xml (0.5.4)
|
95
|
+
nokogiri (1.5.10)
|
96
|
+
paperclip (3.4.2)
|
97
|
+
activemodel (>= 3.0.0)
|
91
98
|
activerecord (>= 3.0.0)
|
92
|
-
|
93
|
-
|
94
|
-
paperclip (2.5.0)
|
95
|
-
activerecord (>= 2.3.0)
|
96
|
-
activesupport (>= 2.3.2)
|
97
|
-
cocaine (>= 0.0.2)
|
99
|
+
activesupport (>= 3.0.0)
|
100
|
+
cocaine (~> 0.5.0)
|
98
101
|
mime-types
|
99
102
|
polyamorous (0.5.0)
|
100
103
|
activerecord (~> 3.0)
|
101
104
|
polyglot (0.3.3)
|
102
|
-
rack (1.
|
105
|
+
rack (1.4.5)
|
103
106
|
rack-cache (1.2)
|
104
107
|
rack (>= 0.4)
|
105
|
-
rack-
|
106
|
-
rack (>= 1.0.0)
|
107
|
-
rack-ssl (1.3.2)
|
108
|
+
rack-ssl (1.3.3)
|
108
109
|
rack
|
109
|
-
rack-test (0.6.
|
110
|
+
rack-test (0.6.2)
|
110
111
|
rack (>= 1.0)
|
111
|
-
rails (3.
|
112
|
-
actionmailer (= 3.
|
113
|
-
actionpack (= 3.
|
114
|
-
activerecord (= 3.
|
115
|
-
activeresource (= 3.
|
116
|
-
activesupport (= 3.
|
112
|
+
rails (3.2.13)
|
113
|
+
actionmailer (= 3.2.13)
|
114
|
+
actionpack (= 3.2.13)
|
115
|
+
activerecord (= 3.2.13)
|
116
|
+
activeresource (= 3.2.13)
|
117
|
+
activesupport (= 3.2.13)
|
117
118
|
bundler (~> 1.0)
|
118
|
-
railties (= 3.
|
119
|
-
railties (3.
|
120
|
-
actionpack (= 3.
|
121
|
-
activesupport (= 3.
|
119
|
+
railties (= 3.2.13)
|
120
|
+
railties (3.2.13)
|
121
|
+
actionpack (= 3.2.13)
|
122
|
+
activesupport (= 3.2.13)
|
122
123
|
rack-ssl (~> 1.3.2)
|
123
124
|
rake (>= 0.8.7)
|
124
125
|
rdoc (~> 3.4)
|
125
|
-
thor (
|
126
|
-
rake (
|
127
|
-
|
126
|
+
thor (>= 0.14.6, < 2.0)
|
127
|
+
rake (10.1.0)
|
128
|
+
ransack (0.7.2)
|
129
|
+
actionpack (~> 3.0)
|
130
|
+
activerecord (~> 3.0)
|
131
|
+
polyamorous (~> 0.5.0)
|
132
|
+
rdoc (3.12.2)
|
128
133
|
json (~> 1.4)
|
129
134
|
ruby-debug-base19 (0.11.25)
|
130
135
|
columnize (>= 0.3.1)
|
@@ -136,37 +141,46 @@ GEM
|
|
136
141
|
ruby-debug-base19 (>= 0.11.19)
|
137
142
|
ruby_core_source (0.1.5)
|
138
143
|
archive-tar-minitar (>= 0.5.2)
|
139
|
-
spree_core (
|
140
|
-
activemerchant (
|
141
|
-
acts_as_list (= 0.
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
144
|
+
spree_core (2.0.3)
|
145
|
+
activemerchant (~> 1.31)
|
146
|
+
acts_as_list (= 0.2.0)
|
147
|
+
awesome_nested_set (= 2.1.5)
|
148
|
+
aws-sdk (~> 1.3.4)
|
149
|
+
cancan (= 1.6.8)
|
150
|
+
deface (>= 0.9.0)
|
151
|
+
ffaker (~> 1.16.1)
|
152
|
+
highline (= 1.6.18)
|
153
|
+
httparty (~> 0.11)
|
154
|
+
json (>= 1.7.7)
|
155
|
+
kaminari (= 0.13.0)
|
156
|
+
money (= 5.1.1)
|
157
|
+
paperclip (~> 3.4.1)
|
158
|
+
rails (~> 3.2.13)
|
159
|
+
ransack (= 0.7.2)
|
160
|
+
state_machine (= 1.2.0)
|
161
|
+
stringex (~> 1.5.1)
|
162
|
+
truncate_html (= 0.9.2)
|
163
|
+
sprockets (2.2.2)
|
154
164
|
hike (~> 1.2)
|
165
|
+
multi_json (~> 1.0)
|
155
166
|
rack (~> 1.0)
|
156
167
|
tilt (~> 1.1, != 1.3.0)
|
157
|
-
state_machine (1.
|
158
|
-
stringex (1.
|
159
|
-
thor (0.
|
160
|
-
tilt (1.
|
161
|
-
treetop (1.4.
|
168
|
+
state_machine (1.2.0)
|
169
|
+
stringex (1.5.1)
|
170
|
+
thor (0.18.1)
|
171
|
+
tilt (1.4.1)
|
172
|
+
treetop (1.4.14)
|
162
173
|
polyglot
|
163
174
|
polyglot (>= 0.3.1)
|
164
|
-
|
175
|
+
truncate_html (0.9.2)
|
176
|
+
tzinfo (0.3.37)
|
177
|
+
uuidtools (2.1.4)
|
165
178
|
|
166
179
|
PLATFORMS
|
167
180
|
ruby
|
168
181
|
|
169
182
|
DEPENDENCIES
|
170
183
|
ffaker
|
184
|
+
haml
|
171
185
|
ruby-debug19
|
172
186
|
spree_news!
|
data/README.md
CHANGED
@@ -1,21 +1,31 @@
|
|
1
1
|
SpreeNews
|
2
2
|
=========
|
3
3
|
|
4
|
-
|
4
|
+
This is an extension for Spree 2.2 that allows an Admin to create and manage posts in the admin panel. Posts that are marked as published will show up on the home page in a news ticker window that uses jquery to slide between posts. If there are no published posts, the news ticker window will not show up on the home page.
|
5
5
|
|
6
6
|
|
7
|
-
|
7
|
+
Installation
|
8
8
|
=======
|
9
9
|
|
10
|
-
|
10
|
+
Create a new rails/spree app:
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
rails new mystore
|
13
|
+
spree install mystore
|
14
|
+
cd mystore
|
14
15
|
|
15
|
-
|
16
|
+
Then add the following to your Gemfile:
|
16
17
|
|
17
|
-
|
18
|
-
$ bundle exec rake test_app
|
19
|
-
$ bundle exec rspec spec
|
18
|
+
gem 'spree_news'
|
20
19
|
|
21
|
-
|
20
|
+
Then install the extension and start the server:
|
21
|
+
|
22
|
+
bundle install
|
23
|
+
rails g spree_news:install (select 'yes' to run migrations)
|
24
|
+
rails s
|
25
|
+
|
26
|
+
Usage
|
27
|
+
=======
|
28
|
+
|
29
|
+
To use, go to /admin and select the 'posts' tab. Create a new post with a title and description and select the 'published' check box to make it appear on the home page.
|
30
|
+
|
31
|
+
Once created, navigate to '/' to see the news ticker show up below the products.
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require spree/backend
|
@@ -1,2 +1,2 @@
|
|
1
|
-
//= require
|
1
|
+
//= require spree/frontend
|
2
2
|
//= require jquery.vticker-min.js
|
@@ -13,7 +13,7 @@ class Spree::Admin::PostsController < Spree::Admin::ResourceController
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def create
|
16
|
-
@post = Spree::Post.new(
|
16
|
+
@post = Spree::Post.new(post_params)
|
17
17
|
if @post.save
|
18
18
|
flash[:notice] = "Post saved successfully"
|
19
19
|
redirect_to admin_posts_path
|
@@ -29,7 +29,7 @@ class Spree::Admin::PostsController < Spree::Admin::ResourceController
|
|
29
29
|
|
30
30
|
def update
|
31
31
|
@post = Spree::Post.find(params[:id])
|
32
|
-
if @post.update_attributes(
|
32
|
+
if @post.update_attributes(post_params)
|
33
33
|
flash[:notice] = "Post saved successfully"
|
34
34
|
redirect_to admin_posts_path
|
35
35
|
else
|
@@ -41,10 +41,18 @@ class Spree::Admin::PostsController < Spree::Admin::ResourceController
|
|
41
41
|
def destroy
|
42
42
|
@post = Spree::Post.find(params[:id])
|
43
43
|
if @post.destroy
|
44
|
+
flash[:notice] = "Post removed successfully"
|
44
45
|
redirect_to admin_posts_path
|
45
46
|
else
|
47
|
+
flash[:alert] = "There was an error removing the post"
|
46
48
|
redirect_to :back
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
52
|
+
private
|
53
|
+
|
54
|
+
def post_params
|
55
|
+
params.require(:post).permit(:title, :description, :published)
|
56
|
+
end
|
57
|
+
|
50
58
|
end
|
data/app/models/spree/post.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class Spree::Post < ActiveRecord::Base
|
2
|
-
validates_presence_of :description
|
3
|
-
# validates_length_of :description, :maximum => 150
|
2
|
+
validates_presence_of :title, :description
|
4
3
|
|
5
4
|
scope :published, lambda { where(:published => true) }
|
5
|
+
scope :latest, order("created_at DESC").limit(3)
|
6
6
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
Deface::Override.new(:virtual_path => "spree/
|
1
|
+
Deface::Override.new(:virtual_path => "spree/admin/shared/_menu",
|
2
2
|
:name => "news_admin_tab",
|
3
3
|
:insert_bottom => "[data-hook='admin_tabs']",
|
4
|
-
:text => "<%= tab(:posts) %>",
|
4
|
+
:text => "<%= tab(:posts, :icon => 'icon-file-text') %>",
|
5
5
|
:disabled => false)
|
6
6
|
|
7
7
|
Deface::Override.new(:virtual_path => "spree/home/index",
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<% if Spree::Post.published.any? %>
|
2
|
+
<div class="news-ticker">
|
3
|
+
<h3>Latest News</h3>
|
4
|
+
<p></p>
|
5
|
+
<div id="news-container">
|
6
|
+
<ul>
|
7
|
+
<% Spree::Post.published.each do |post| %>
|
8
|
+
<li>
|
9
|
+
<div>
|
10
|
+
<h6>
|
11
|
+
<%= post.created_at.strftime("%B %d, %Y") %>
|
12
|
+
</h6>
|
13
|
+
<%= post.description %>
|
14
|
+
</div>
|
15
|
+
</li>
|
16
|
+
<% end %>
|
17
|
+
</ul>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
<script>
|
21
|
+
$(function(){
|
22
|
+
$('#news-container').vTicker({
|
23
|
+
speed: 1000,
|
24
|
+
pause: 4000,
|
25
|
+
animation: 'fade',
|
26
|
+
mousePause: true,
|
27
|
+
showItems: 1
|
28
|
+
});
|
29
|
+
});
|
30
|
+
</script>
|
31
|
+
<% end %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<p><%= f.label :title, Spree::Post.human_attribute_name(:title) %></p>
|
2
|
+
<p><%= f.text_field :title %></p>
|
3
|
+
<p><%= f.label :description, Spree::Post.human_attribute_name(:description) %></p>
|
4
|
+
<p><%= f.text_area :description %></p>
|
5
|
+
<p><%= f.label :published, Spree::Post.human_attribute_name(:published) %></p>
|
6
|
+
<p><%= f.check_box :published %></p>
|
7
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<h1>
|
2
|
+
<%= t(:posts) %>
|
3
|
+
</h1>
|
4
|
+
<div class="new-post">
|
5
|
+
<%= button_link_to t("admin_posts.add_news"), new_object_url, :icon => 'add', :id => 'admin_new_post_link' %>
|
6
|
+
</div>
|
7
|
+
<table class="index" id="listing_posts">
|
8
|
+
<thead>
|
9
|
+
<th>
|
10
|
+
<%= Spree::Post.human_attribute_name(:title) %>
|
11
|
+
</th>
|
12
|
+
<th></th>
|
13
|
+
<th></th>
|
14
|
+
</thead>
|
15
|
+
<tbody>
|
16
|
+
<% @posts.each do |post| %>
|
17
|
+
<tr>
|
18
|
+
<td>
|
19
|
+
<%= link_to post.title, object_url(post) %>
|
20
|
+
</td>
|
21
|
+
<td>
|
22
|
+
<%= link_to_edit post %>
|
23
|
+
</td>
|
24
|
+
<td>
|
25
|
+
<%= link_to_delete post %>
|
26
|
+
</td>
|
27
|
+
</tr>
|
28
|
+
<% end %>
|
29
|
+
</tbody>
|
30
|
+
</table>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
|
2
|
+
<h1>
|
3
|
+
<%= t("admin_posts.add_news") %>
|
4
|
+
</h1>
|
5
|
+
<%= form_for [:admin, @post] do |f| %>
|
6
|
+
<%= render :partial => 'form', :locals => {:f => f} %>
|
7
|
+
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
|
8
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<h1>
|
2
|
+
<%= "Showing News Post: #{@post.title}" %>
|
3
|
+
</h1>
|
4
|
+
<p></p>
|
5
|
+
<h4>
|
6
|
+
<%= "Title: #{@post.title}" %>
|
7
|
+
</h4>
|
8
|
+
<h4>
|
9
|
+
<%= t(:description) %>
|
10
|
+
</h4>
|
11
|
+
<%= @post.description %>
|
12
|
+
<p></p>
|
13
|
+
<%= link_to_edit @post, :class => 'edit_slide' %>
|
14
|
+
<%= t(:or) %>
|
15
|
+
<%= link_to t(:back), collection_url %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div data-hook="news">
|
2
|
+
<h1>
|
3
|
+
<%= t("posts") %>
|
4
|
+
</h1>
|
5
|
+
<ul>
|
6
|
+
<% @posts.each do |post| %>
|
7
|
+
<li>
|
8
|
+
<div>
|
9
|
+
<h6>
|
10
|
+
<%= l(post.created_at, format: "%d %B %Y") %>
|
11
|
+
</h6>
|
12
|
+
<%= link_to post.title, post %>
|
13
|
+
</div>
|
14
|
+
</li>
|
15
|
+
<% end %>
|
16
|
+
</ul>
|
17
|
+
</div>
|
data/config/locales/en.yml
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
+
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
+
|
4
|
+
ru:
|
5
|
+
hello: "Hello world"
|
6
|
+
posts: "Новости"
|
7
|
+
admin_posts:
|
8
|
+
add_news: "Добавить новость"
|
9
|
+
edit_news: "Редактирование новости"
|
10
|
+
|
11
|
+
activerecord:
|
12
|
+
attributes:
|
13
|
+
spree/post:
|
14
|
+
title: Заголовок
|
15
|
+
description: Описание
|
16
|
+
published: Опубликовано
|
data/config/routes.rb
CHANGED
@@ -3,13 +3,13 @@ module SpreeNews
|
|
3
3
|
class InstallGenerator < Rails::Generators::Base
|
4
4
|
|
5
5
|
def add_javascripts
|
6
|
-
append_file "
|
7
|
-
append_file "
|
6
|
+
append_file "vendor/assets/javascripts/spree/frontend/all.js", "//= require frontend/spree_news\n"
|
7
|
+
append_file "vendor/assets/javascripts/spree/backend/all.js", "//= require backend/spree_news\n"
|
8
8
|
end
|
9
9
|
|
10
10
|
def add_stylesheets
|
11
|
-
inject_into_file "
|
12
|
-
inject_into_file "
|
11
|
+
inject_into_file "vendor/assets/stylesheets/spree/frontend/all.css", " *= require frontend/spree_news\n", :before => /\*\//, :verbose => true
|
12
|
+
inject_into_file "vendor/assets/stylesheets/spree/backend/all.css", " *= require backend/spree_news\n", :before => /\*\//, :verbose => true
|
13
13
|
end
|
14
14
|
|
15
15
|
def add_migrations
|
data/spree_news.gemspec
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.platform = Gem::Platform::RUBY
|
4
4
|
s.name = 'spree_news'
|
5
|
-
s.version = '0.0
|
5
|
+
s.version = '1.0.0'
|
6
6
|
s.summary = 'Adds a Javascript enabled scrolling news feed ticker wherever you call it'
|
7
7
|
s.description = 'Provides an Admin view to create/edit posts which will be shown on the home page in a scrolling news ticker window below the products listing.'
|
8
8
|
s.required_ruby_version = '>= 1.9.2'
|
9
9
|
|
10
10
|
s.author = 'JD Warren'
|
11
|
-
s.email = '
|
11
|
+
s.email = 'johndavid400@gmail.com'
|
12
12
|
s.homepage = 'http://github.com/johndavid400/spree_news'
|
13
13
|
|
14
14
|
s.files = `git ls-files`.split("\n")
|
@@ -16,7 +16,4 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.require_path = 'lib'
|
17
17
|
s.requirements << 'none'
|
18
18
|
|
19
|
-
s.add_dependency 'spree_core', '~> 1.0.0'
|
20
|
-
s.add_dependency 'haml', '~> 3.1.4'
|
21
|
-
|
22
19
|
end
|
metadata
CHANGED
@@ -1,51 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_news
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- JD Warren
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: spree_core
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 1.0.0
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 1.0.0
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: haml
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 3.1.4
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 3.1.4
|
11
|
+
date: 2014-07-07 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
46
13
|
description: Provides an Admin view to create/edit posts which will be shown on the
|
47
14
|
home page in a scrolling news ticker window below the products listing.
|
48
|
-
email:
|
15
|
+
email: johndavid400@gmail.com
|
49
16
|
executables: []
|
50
17
|
extensions: []
|
51
18
|
extra_rdoc_files: []
|
@@ -58,23 +25,27 @@ files:
|
|
58
25
|
- README.md
|
59
26
|
- Rakefile
|
60
27
|
- Versionfile
|
61
|
-
- app/assets/javascripts/
|
28
|
+
- app/assets/javascripts/backend/spree_news.js
|
29
|
+
- app/assets/javascripts/frontend/spree_news.js
|
62
30
|
- app/assets/javascripts/jquery.vticker-min.js
|
63
31
|
- app/assets/javascripts/posts.js.coffee
|
64
|
-
- app/assets/
|
65
|
-
- app/assets/stylesheets/
|
32
|
+
- app/assets/stylesheets/backend/spree_news.css
|
33
|
+
- app/assets/stylesheets/frontend/spree_news.css
|
66
34
|
- app/assets/stylesheets/posts.css.scss
|
67
|
-
- app/assets/stylesheets/store/spree_news.css
|
68
35
|
- app/controllers/spree/admin/posts_controller.rb
|
36
|
+
- app/controllers/spree/posts_controller.rb
|
69
37
|
- app/models/spree/post.rb
|
70
38
|
- app/overrides/spree_news_overrides.rb
|
71
|
-
- app/views/shared/_news.html.
|
72
|
-
- app/views/spree/admin/posts/_form.html.
|
73
|
-
- app/views/spree/admin/posts/edit.html.
|
74
|
-
- app/views/spree/admin/posts/index.html.
|
75
|
-
- app/views/spree/admin/posts/new.html.
|
76
|
-
- app/views/spree/admin/posts/show.html.
|
39
|
+
- app/views/shared/_news.html.erb
|
40
|
+
- app/views/spree/admin/posts/_form.html.erb
|
41
|
+
- app/views/spree/admin/posts/edit.html.erb
|
42
|
+
- app/views/spree/admin/posts/index.html.erb
|
43
|
+
- app/views/spree/admin/posts/new.html.erb
|
44
|
+
- app/views/spree/admin/posts/show.html.erb
|
45
|
+
- app/views/spree/posts/index.html.erb
|
46
|
+
- app/views/spree/posts/show.html.erb
|
77
47
|
- config/locales/en.yml
|
48
|
+
- config/locales/ru.yml
|
78
49
|
- config/routes.rb
|
79
50
|
- db/migrate/20120312183513_create_posts.rb
|
80
51
|
- lib/generators/spree_news/install/install_generator.rb
|
@@ -89,27 +60,31 @@ files:
|
|
89
60
|
- test/unit/post_test.rb
|
90
61
|
homepage: http://github.com/johndavid400/spree_news
|
91
62
|
licenses: []
|
63
|
+
metadata: {}
|
92
64
|
post_install_message:
|
93
65
|
rdoc_options: []
|
94
66
|
require_paths:
|
95
67
|
- lib
|
96
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
69
|
requirements:
|
99
|
-
- -
|
70
|
+
- - '>='
|
100
71
|
- !ruby/object:Gem::Version
|
101
72
|
version: 1.9.2
|
102
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
74
|
requirements:
|
105
|
-
- -
|
75
|
+
- - '>='
|
106
76
|
- !ruby/object:Gem::Version
|
107
77
|
version: '0'
|
108
78
|
requirements:
|
109
79
|
- none
|
110
80
|
rubyforge_project:
|
111
|
-
rubygems_version:
|
81
|
+
rubygems_version: 2.3.0
|
112
82
|
signing_key:
|
113
|
-
specification_version:
|
83
|
+
specification_version: 4
|
114
84
|
summary: Adds a Javascript enabled scrolling news feed ticker wherever you call it
|
115
|
-
test_files:
|
85
|
+
test_files:
|
86
|
+
- spec/spec_helper.rb
|
87
|
+
- test/fixtures/posts.yml
|
88
|
+
- test/functional/posts_controller_test.rb
|
89
|
+
- test/unit/helpers/posts_helper_test.rb
|
90
|
+
- test/unit/post_test.rb
|
@@ -1,22 +0,0 @@
|
|
1
|
-
- if Spree::Post.all.any?
|
2
|
-
.news-ticker
|
3
|
-
%h3 Latest News
|
4
|
-
%p
|
5
|
-
#news-container
|
6
|
-
%ul
|
7
|
-
- Spree::Post.published.each do |post|
|
8
|
-
%li
|
9
|
-
%div
|
10
|
-
%h6= post.created_at.strftime("%B %d, %Y")
|
11
|
-
= post.description
|
12
|
-
|
13
|
-
:javascript
|
14
|
-
$(function(){
|
15
|
-
$('#news-container').vTicker({
|
16
|
-
speed: 1000,
|
17
|
-
pause: 4000,
|
18
|
-
animation: 'fade',
|
19
|
-
mousePause: true,
|
20
|
-
showItems: 1
|
21
|
-
});
|
22
|
-
});
|
@@ -1,18 +0,0 @@
|
|
1
|
-
= render :partial => 'spree/admin/shared/configuration_menu'
|
2
|
-
%h1 Posts
|
3
|
-
.new-post= button_link_to 'New Post', new_object_url, :icon => 'add', :id => 'admin_new_post_link'
|
4
|
-
|
5
|
-
%table.index#listing_posts
|
6
|
-
%thead
|
7
|
-
%th Name
|
8
|
-
%th Text
|
9
|
-
%th
|
10
|
-
%th
|
11
|
-
%tbody
|
12
|
-
- @posts.each do |post|
|
13
|
-
%tr
|
14
|
-
%td= link_to post.title, object_url(post)
|
15
|
-
%td= post.description.html_safe
|
16
|
-
%td= link_to_edit post
|
17
|
-
%td= link_to_delete post
|
18
|
-
|