Skip to content

Commit

Permalink
Merge branch 'release/0.3.9'
Browse files Browse the repository at this point in the history
* release/0.3.9:
  Add about site category
  • Loading branch information
kalashnikovisme committed Jul 31, 2015
2 parents 1b25a75 + 51bf853 commit 1263d15
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
2 changes: 2 additions & 0 deletions app/controllers/web/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ class Web::ApplicationController < ApplicationController

def load_categories_tree
@first_category = Category.find_by_name 'Кто мы такие'
@about_site_category = Category.find_by_name 'Сайт МИЦ'
contact_category = Category.find_by_name 'Контакты'
@contact_article = contact_category.articles.first if contact_category
if signed_in?
@korporative_category = Category.find_by_name 'Корпоративные проекты'
end
@feedback = FeedbackForm.new_with_model
@rss_article_id = 19
@month_article = Article.find 21
end

def notification_count
Expand Down
16 changes: 13 additions & 3 deletions app/views/layouts/web/shared/_navbar.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
.icon-facebook.min-icon
= link_to new_session_path do
.icon-door.min-icon

%li.banner-container
- if signed_in?
.banner.signed-in
Expand Down Expand Up @@ -63,7 +62,7 @@
%a.site-logo{ href: root_path }
%ul.left
%li.has-dropdown.dropdown-category-menu
%a{href: "#"}
%a{ href: '#' }
.inner
Миц - это ...
%ul.dropdown
Expand All @@ -74,8 +73,19 @@
= @first_category.name
- @first_category.articles.confirmed.each do |article|
= link_to article.title, article_path(article)
%li
- if @about_site_category.present?
.category-column
.menu-title
= @about_site_category.name
- @about_site_category.articles.confirmed.each do |article|
= link_to article.title, article_path(article)
%li{ style: 'margin-right: 15px' }
- if signed_in? && current_user.state == 'confirmed'
= link_to '#', data: { 'reveal-id' => 'feedbackModal' } do
.inner
Нашли ошибку?
- if @month_article.present?
%li
= link_to article_path(@month_article) do
.inner
Июль 2015
9 changes: 8 additions & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@
Page.create slug: slug, view: slug, title: pages[slug] unless page
end

['Кто мы такие', 'Контакты'].each do |name|
['Кто мы такие', 'Контакты', 'Сайт МИЦ'].each do |name|
category = Category.find_by_name name
Category.create name: name unless category
end
contact_category = Category.find_by_name 'Контакты'
contact_article = contact_category.articles.first
Article.create title: 'Контакты', view: 'contacts', category_id: contact_category.id, user_id: 1 unless contact_article

# Create month article
month_article_id = 21
about_site_category = Category.find_by_name 'Сайт МИЦ'
article = Article.where id: month_article_id
article = Article.create title: 'Статья месяца', category_id: about_site_category.id, user_id: 1 unless article.any?
Article.update article.id, id: month_article_id
8 changes: 8 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ def load_fixture(filename)

Category.create name: 'Контакты'
Category.first.articles.build(title: 'Контакты', user_id: 1).save

month_article_id = 21
a = Article.find month_article_id
unless a
a = Article.create title: 'Статья месяца'
a.id = month_article_id
a.save
end
end

0 comments on commit 1263d15

Please sign in to comment.