-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* release/0.3.2: Feedback #2377 content RSS Feedback #2377 rss articlesj Feedback #2377 add RSS feed Esli Pasha hochet rasshirjaemost', to Pasha poluchit rasshirjaemost' fix config #151 add configuration for server mailer fix config fix with sender email
- Loading branch information
Showing
27 changed files
with
213 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class Rss::ApplicationController < ApplicationController | ||
before_filter :set_rss_format | ||
|
||
private | ||
|
||
def set_rss_format | ||
request.format = :xml | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Rss::ArticlesController < Rss::ApplicationController | ||
def index | ||
@articles = Article.broadcasted.decorate | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Rss::ContentController < Rss::ApplicationController | ||
def index | ||
articles = Article.broadcasted.decorate | ||
news = News.published | ||
@content = Kaminari.paginate_array (articles + news).sort_by{ |post| post.created_at } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Rss::NewsController < Rss::ApplicationController | ||
def index | ||
@news = News.published.page params[:page] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,6 @@ def short_body | |
def name | ||
title | ||
end | ||
|
||
alias :lead :short_body | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Rss::ApplicationHelper | ||
def next_page | ||
params[:page].present? ? page = params[:page].to_i + 1 : page = 2 | ||
send "#{params[:controller].gsub('/', '_')}_index_url", page: page | ||
end | ||
|
||
def header(xml) | ||
xml.title t('.title') | ||
xml.description t('.description') | ||
xml.link root_url | ||
xml.language 'ru' | ||
xml.image do | ||
xml.url 'http://ulmic.ru/assets/apps/logo-mic-square.png' | ||
xml.width 100 | ||
xml.height 100 | ||
end | ||
end | ||
|
||
def rss_params | ||
{ version: '2.0', 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/', 'xmlns:ya' => 'http://blogs.yandex.ru/yarss/', 'xmlns:wfw' => 'http://wellformedweb.org/CommentAPI/' } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
module Concerns | ||
module MessageConstructor | ||
|
||
def create_message(type, theme) | ||
messages_hash[type][theme] | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,5 @@ def just_message(user, message, subject) | |
@message = message | ||
mail(to: user.email, subject: subject) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
xml.item do | ||
xml.guid article_url(item), isPermaLink: true | ||
xml.author root_url | ||
xml.pubDate item.created_at.to_s(:rfc822) | ||
xml.link article_url(item) | ||
xml.description item.lead | ||
xml.title item.title | ||
xml.category item.category.name | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
xml.rss rss_params do | ||
xml.channel do | ||
header xml | ||
|
||
for article in @articles | ||
xml << render('item', xml: xml, item: article) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
xml.rss rss_params do | ||
xml.channel do | ||
header xml | ||
|
||
for post in @content | ||
instance_name = post.model_name.name.underscore | ||
xml << render("rss/#{instance_name.pluralize(:en)}/item", xml: xml, item: post) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
xml.item do | ||
xml.guid news_url(item), isPermaLink: true | ||
xml.author root_url | ||
xml.pubDate item.published_at.to_s(:rfc822) | ||
xml.link news_url(item) | ||
xml.description item.lead | ||
xml.title item.title | ||
xml.category item.category | ||
xml.tag! 'dc:creator', item.member.decorate.short_name | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
xml.rss rss_params do | ||
xml.channel do | ||
header xml | ||
|
||
for news in @news | ||
xml<< render('item', xml: xml, item: news) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
ru: | ||
rss: | ||
news: | ||
index: | ||
title: Молодёжный инициативный центр | ||
description: Новости Молодёжного инициативного центра | ||
articles: | ||
index: | ||
title: Молодёжный инициативный центр | ||
description: Статьи сайта Молодёжного инициативного центра | ||
content: | ||
index: | ||
title: Молодёжный инициативный центр | ||
description: Весь контент (новости, статьи) сайта Молодёжного инициативного центра |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'test_helper' | ||
|
||
class Rss::ApplicationControllerTest < ActionController::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'test_helper' | ||
|
||
class Rss::ArticlesControllerTest < ActionController::TestCase | ||
setup do | ||
create :user | ||
@article = create :article | ||
end | ||
|
||
test 'should get index' do | ||
get :index | ||
assert_response :success, @response.body | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'test_helper' | ||
|
||
class Rss::ContentControllerTest < ActionController::TestCase | ||
setup do | ||
create :user | ||
create :member | ||
create :article | ||
create :news | ||
end | ||
|
||
test 'should get index' do | ||
get :index | ||
assert_response :success, @response.body | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'test_helper' | ||
|
||
class Rss::NewsControllerTest < ActionController::TestCase | ||
setup do | ||
@news = create :news | ||
end | ||
|
||
test 'should get index' do | ||
get :index | ||
assert_response :success, @response.body | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require 'test_helper' | ||
require 'redis' | ||
|
||
class UserMailerTest < ActionMailer::TestCase | ||
setup do | ||
@user = create :user | ||
end | ||
|
||
test "check user email" do | ||
Redis.new.ping | ||
@user.generate_token | ||
|
||
assert_emails 1 do | ||
email = UserMailer.confirmation_instructions(@user).deliver_now | ||
end | ||
ap email | ||
end | ||
|
||
|
||
end |