From 9b92aa410827c25ba00b03351fb5241ca6c3510c Mon Sep 17 00:00:00 2001 From: arugin Date: Tue, 3 Dec 2013 23:06:58 +0400 Subject: [PATCH] Contents page redisign --- ...{application.css.scss => application.scss} | 4 +++ app/assets/stylesheets/articles.scss | 14 ++++---- ....css.scss => bootstrap_and_overrides.scss} | 0 ...ditor_fixes.css.scss => editor_fixes.scss} | 0 ...s.css.scss => fotorama_and_overrides.scss} | 0 app/controllers/contents_controller.rb | 2 +- app/models/content/base_content.rb | 6 ++++ app/views/articles/_article_block.html.haml | 4 +-- .../articles/_article_cool_block.html.haml | 32 ------------------- .../articles/_article_short_block.html.haml | 20 ++++-------- .../articles/_article_tiny_block.html.haml | 12 +++---- .../articles/_index_articles_block.html.haml | 6 ++-- app/views/articles/_thumb.html.haml | 2 ++ app/views/articles/_title.html.haml | 6 ++++ app/views/articles/index.html.haml | 2 ++ app/views/articles/news.html.haml | 2 ++ app/views/common/_cool_block.html.haml | 27 ++++++++++++++++ app/views/contents/_content_block.html.haml | 1 + .../contents/_content_short_block.html.haml | 21 ------------ .../contents/_contents_short_block.html.haml | 6 ++-- app/views/contents/_thumb.html.haml | 2 ++ app/views/contents/_title.html.haml | 2 ++ app/views/contents/index.html.haml | 2 ++ app/views/projects/index.html.haml | 2 ++ config/initializers/version.rb | 2 +- 25 files changed, 89 insertions(+), 88 deletions(-) rename app/assets/stylesheets/{application.css.scss => application.scss} (99%) rename app/assets/stylesheets/{bootstrap_and_overrides.css.scss => bootstrap_and_overrides.scss} (100%) rename app/assets/stylesheets/{editor_fixes.css.scss => editor_fixes.scss} (100%) rename app/assets/stylesheets/{fotorama_and_overrides.css.scss => fotorama_and_overrides.scss} (100%) delete mode 100644 app/views/articles/_article_cool_block.html.haml create mode 100644 app/views/articles/_thumb.html.haml create mode 100644 app/views/articles/_title.html.haml create mode 100644 app/views/common/_cool_block.html.haml delete mode 100644 app/views/contents/_content_short_block.html.haml create mode 100644 app/views/contents/_thumb.html.haml create mode 100644 app/views/contents/_title.html.haml diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.scss similarity index 99% rename from app/assets/stylesheets/application.css.scss rename to app/assets/stylesheets/application.scss index 57c4c54..e89236b 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.scss @@ -326,6 +326,10 @@ h4.random-news{ padding-left: 0px; } +#index-contents{ + @extend #articles; +} + #users{ @extend #articles; } diff --git a/app/assets/stylesheets/articles.scss b/app/assets/stylesheets/articles.scss index fcd1064..8b1dbff 100644 --- a/app/assets/stylesheets/articles.scss +++ b/app/assets/stylesheets/articles.scss @@ -1,10 +1,10 @@ -.article-wrapper{ +.item-wrapper{ border-radius: 9px; background: #eee; padding: 4px; margin-bottom: 20px; clear: both; - .article-card{ + .item-card{ overflow: hidden; border-radius: 6px; border: 1px solid #ddd; @@ -12,7 +12,7 @@ background-color: #fff; padding: 5px; height: 390px; - .article-thumb { + .item-thumb { width: 212px; height: 150px; margin: 0; @@ -61,7 +61,7 @@ padding-top: 2px; } } - .article-meta{ + .item-meta{ list-style: none; width: 190px; bottom: 68px; @@ -71,7 +71,7 @@ font-size: 11px; } } - ul.article-stats{ + ul.item-stats{ margin: 0; padding: 0; border: 0; @@ -95,7 +95,7 @@ } } } -ul.articles-card-list{ +ul.items-card-list{ width: 760px; background: #fff; list-style: none; @@ -104,7 +104,7 @@ ul.articles-card-list{ z-index: 2; display: block; float: left; - li.article{ + li.item{ display: inline; float: left; margin-left: 10px; diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.scss b/app/assets/stylesheets/bootstrap_and_overrides.scss similarity index 100% rename from app/assets/stylesheets/bootstrap_and_overrides.css.scss rename to app/assets/stylesheets/bootstrap_and_overrides.scss diff --git a/app/assets/stylesheets/editor_fixes.css.scss b/app/assets/stylesheets/editor_fixes.scss similarity index 100% rename from app/assets/stylesheets/editor_fixes.css.scss rename to app/assets/stylesheets/editor_fixes.scss diff --git a/app/assets/stylesheets/fotorama_and_overrides.css.scss b/app/assets/stylesheets/fotorama_and_overrides.scss similarity index 100% rename from app/assets/stylesheets/fotorama_and_overrides.css.scss rename to app/assets/stylesheets/fotorama_and_overrides.scss diff --git a/app/controllers/contents_controller.rb b/app/controllers/contents_controller.rb index c1b9344..8c93dce 100644 --- a/app/controllers/contents_controller.rb +++ b/app/controllers/contents_controller.rb @@ -21,7 +21,7 @@ def approve end #TODO: move to model def index - @contents = Content::BaseContent.search_for(current_user,params).where(approved_to_news: true, reviewed: true).page(params[:page]).per(10) + @contents = Content::BaseContent.search_for(current_user,params).where(approved_to_news: true, reviewed: true).page(params[:page]).per(9) end def create diff --git a/app/models/content/base_content.rb b/app/models/content/base_content.rb index a664927..ca27c4d 100644 --- a/app/models/content/base_content.rb +++ b/app/models/content/base_content.rb @@ -9,6 +9,7 @@ class BaseContent include Concerns::Ownerable include Concerns::Taggable include Mongo::Voteable + include ActionView::Helpers::TextHelper is_impressionable counter_cache: true, :unique => :ip_address @@ -38,6 +39,8 @@ class BaseContent search_for(user,params).where(reviewed: false) } + alias :content :description + voteable self, :up => +1, :down => -1 def youtube_or_vimeo_url @@ -46,6 +49,9 @@ def youtube_or_vimeo_url errors.add(:src, :invalid) end + def tiny_content + strip_tags self.description + end end end \ No newline at end of file diff --git a/app/views/articles/_article_block.html.haml b/app/views/articles/_article_block.html.haml index 6f16e0a..77c43dd 100644 --- a/app/views/articles/_article_block.html.haml +++ b/app/views/articles/_article_block.html.haml @@ -6,7 +6,7 @@ = article.cycle.correct_title %span.divider / = link_to article_path(article), itemprop:"url" do - %span= title article.title + %span{itemprop:"name"}= title article.title .news-user-avatar - if article.author.avatar.nil? = image_tag("/images/main/profile/stub-user-middle.gif", :title => "user avatar") @@ -20,7 +20,7 @@ %span{itemprop:'name'} = article.author.name .publishDate - %span{itemprop:'datePublished',content:article.created_at} + %span{itemprop:'datePublished', content:article.created_at} = l article.created_at.in_time_zone, format: :short .clear .views diff --git a/app/views/articles/_article_cool_block.html.haml b/app/views/articles/_article_cool_block.html.haml deleted file mode 100644 index d497e09..0000000 --- a/app/views/articles/_article_cool_block.html.haml +++ /dev/null @@ -1,32 +0,0 @@ -.article-wrapper - .article-card - .article-thumb - = link_to article_path(article) do - = image_tag(article.get_logo_url.nil? ? '/images/common/filer.png': article.get_logo_url, title: article.title) - %h4 - - if article.is_garbage - = link_to draft_article_path(article) do - %strong= article.title - - else - = link_to article_path(article) do - %strong= article.title - %span - = link_to user_profile_path(article.author) do - = "от автора #{article.author.name}" - .clear - - unless article.content.nil? - %p - = article.tiny_content - %ul.article-meta - %li.publishDate - %span - %i.icon-leaf{title: t(:PUBLISH_FULL)} - = l article.created_at.in_time_zone, format: :short - %ul.article-stats - %li.long - = render partial: 'common/views_count', locals: {subject: article, growth: true} - %li.views-wrapper - = render partial: 'common/comments_count', locals: {subject: article} - %li.floated-vote - = render partial: 'common/rate_count', locals: {subject: article} - diff --git a/app/views/articles/_article_short_block.html.haml b/app/views/articles/_article_short_block.html.haml index 305ee2c..9c6d132 100644 --- a/app/views/articles/_article_short_block.html.haml +++ b/app/views/articles/_article_short_block.html.haml @@ -1,21 +1,15 @@ -.row-fluid{itemscope:true, itemtype:'http://schema.org/Article'} +.row-fluid %h4 - - if article.is_garbage - = link_to draft_article_path(article) do - %span= article.title - - else - = link_to article_path(article) do - %span= article.title + = render partial: 'title', locals: {item: article} .author = link_to user_profile_path(article.author) do - %span{itemprop:'author', itemscope:true, itemtype:'http://schema.org/Person'} - %span{itemprop:'name'} - = article.author.name + %span + = article.author.name .publishDate - %span{itemprop:'datePublished',content:article.created_at} + %span = l article.created_at.in_time_zone, format: :short .clear - .description{itemprop:'articleBody'} + .description - unless article.content.nil? = article.short_content.html_safe - else @@ -27,5 +21,5 @@ = link_to article_path(article) do =t 'READ_MORE' .more-info - = link_to article_path(article), itemprop:"url" do + = link_to article_path(article) do =t 'COMMENTS', count: article.comments.size, comment: Russian::pluralize(article.comments.size, 'комментарий','комментария','комментариев') diff --git a/app/views/articles/_article_tiny_block.html.haml b/app/views/articles/_article_tiny_block.html.haml index 83be3e1..36f4716 100644 --- a/app/views/articles/_article_tiny_block.html.haml +++ b/app/views/articles/_article_tiny_block.html.haml @@ -1,17 +1,17 @@ -.row-fluid{itemscope:true, itemtype:'http://schema.org/Article'} +.row-fluid %h4.random-news = link_to article_path(article) do %span= article.title .author = link_to user_profile_path(article.author) do - %span{itemprop:'author', itemscope:true, itemtype:'http://schema.org/Person'} - %span{itemprop:'name'} + %span + %span = article.author.name .publishDate - %span{itemprop:'datePublished',content:article.created_at} + %span = l article.created_at.in_time_zone, format: :short .clear - .description{itemprop:'articleBody'} + .description - unless article.content.nil? %p = article.tiny_content @@ -20,5 +20,5 @@ = link_to article_path(article) do =t 'READ_MORE' .more-info - = link_to article_path(article), itemprop:"url" do + = link_to article_path(article) do =t 'COMMENTS', count: article.comments.size, comment: Russian::pluralize(article.comments.size, 'комментарий','комментария','комментариев') diff --git a/app/views/articles/_index_articles_block.html.haml b/app/views/articles/_index_articles_block.html.haml index c31db59..d7320b8 100644 --- a/app/views/articles/_index_articles_block.html.haml +++ b/app/views/articles/_index_articles_block.html.haml @@ -1,9 +1,9 @@ - if @articles.blank? %p= t("NO_ARTICLES_FOUND") - else - %ul.articles-card-list + %ul.items-card-list - @articles.each do |article| - %li.article - = render :partial => 'article_cool_block', :locals => { :article => article } + %li.item + = render :partial => 'common/cool_block', locals: { item: article, collection: 'articles' } = paginate @articles, :remote => true \ No newline at end of file diff --git a/app/views/articles/_thumb.html.haml b/app/views/articles/_thumb.html.haml new file mode 100644 index 0000000..f8a64bd --- /dev/null +++ b/app/views/articles/_thumb.html.haml @@ -0,0 +1,2 @@ += link_to article_path(item) do + = image_tag(item.get_logo_url.nil? ? '/images/common/filer.png': item.get_logo_url, title: item.title) \ No newline at end of file diff --git a/app/views/articles/_title.html.haml b/app/views/articles/_title.html.haml new file mode 100644 index 0000000..c74c15b --- /dev/null +++ b/app/views/articles/_title.html.haml @@ -0,0 +1,6 @@ +- if item.is_garbage + = link_to draft_article_path(item) do + %strong= item.title +- else + = link_to article_path(item) do + %strong= item.title \ No newline at end of file diff --git a/app/views/articles/index.html.haml b/app/views/articles/index.html.haml index 8ae9374..d832a97 100644 --- a/app/views/articles/index.html.haml +++ b/app/views/articles/index.html.haml @@ -1,3 +1,5 @@ +- keywords "киноиндустрия статьи, статьи про кино, режиссура, актерское мастерство, операторское дело, сценарное мастерство, как попасть в киноиндустрию" +- description "unbe - независимое творческое сообщество, цель которого - сделать систему кинопроизводства в России открытой, а также поднять уровень компетенции и качество работ и роликов на новый уровень" .row-fluid .span4 - unless @article_area.nil? diff --git a/app/views/articles/news.html.haml b/app/views/articles/news.html.haml index 1589b24..780b6f9 100644 --- a/app/views/articles/news.html.haml +++ b/app/views/articles/news.html.haml @@ -1,3 +1,5 @@ +- keywords "новости кино, новости сериалов, киноиндустрия статьи, новости сообщества unbe, статьи про кино" +- description "unbe - независимое творческое сообщество, цель которого - сделать систему кинопроизводства в России открытой, а также поднять уровень компетенции и качество работ и роликов на новый уровень" .row-fluid .span4 %h4.section=title 'Новости' diff --git a/app/views/common/_cool_block.html.haml b/app/views/common/_cool_block.html.haml new file mode 100644 index 0000000..4049419 --- /dev/null +++ b/app/views/common/_cool_block.html.haml @@ -0,0 +1,27 @@ +.item-wrapper + .item-card + .item-thumb + = render partial: "#{collection}/thumb", locals: {item: item} + %h4 + = render partial: "#{collection}/title", locals: {item: item} + %span + = link_to user_profile_path(item.author) do + = "от автора #{item.author.name}" + .clear + - unless item.content.nil? + %p + = item.tiny_content.html_safe + %ul.item-meta + %li.publishDate + %span + %i.icon-leaf{title: t(:PUBLISH_FULL)} + = item.created_at.nil? ? 'До начала времен': l(item.created_at.in_time_zone, format: :short) + + %ul.item-stats + %li.long + = render partial: 'common/views_count', locals: {subject: item, growth: true} + %li.views-wrapper + = render partial: 'common/comments_count', locals: {subject: item} + %li.floated-vote + = render partial: 'common/rate_count', locals: {subject: item} + diff --git a/app/views/contents/_content_block.html.haml b/app/views/contents/_content_block.html.haml index af6be2f..97bf17e 100644 --- a/app/views/contents/_content_block.html.haml +++ b/app/views/contents/_content_block.html.haml @@ -1,4 +1,5 @@ - keywords content.tag_list +- description content.tiny_content .row-fluid %h4 = link_to gallery_path(content.contentable) do diff --git a/app/views/contents/_content_short_block.html.haml b/app/views/contents/_content_short_block.html.haml deleted file mode 100644 index 541fac1..0000000 --- a/app/views/contents/_content_short_block.html.haml +++ /dev/null @@ -1,21 +0,0 @@ -.row-fluid.video - %h4 - = link_to content_base_content_path(content) do - %span= content.title - .author - = link_to user_profile_path(content.author) do - %span{itemprop:'author', itemscope:true, itemtype:'http://schema.org/Person'} - %span{itemprop:'name'} - = content.author.name - .publishDate - %span{itemprop:'datePublished',content:content.created_at} - - if content.created_at.nil? - = l content.contentable.created_at.in_time_zone, format: :short - - else - = l content.created_at.in_time_zone, format: :short - .clear - .container - .fotorama{data:{width:'300px',ratio:"800/600", keyboard: 'true'}} - %a{href: content.src} - .description - = content.description.html_safe \ No newline at end of file diff --git a/app/views/contents/_contents_short_block.html.haml b/app/views/contents/_contents_short_block.html.haml index 3056115..3b780cc 100644 --- a/app/views/contents/_contents_short_block.html.haml +++ b/app/views/contents/_contents_short_block.html.haml @@ -1,8 +1,10 @@ - if @contents.blank? %p= t("NO_CONTENTS_FOUND") - else - - @contents.each do |content| - = render :partial => 'content_short_block', :locals => { :content => content } + %ul.items-card-list + - @contents.each do |content| + %li.item + = render :partial => 'common/cool_block', locals: { item: content, collection: 'contents' } = paginate @contents, :remote => true diff --git a/app/views/contents/_thumb.html.haml b/app/views/contents/_thumb.html.haml new file mode 100644 index 0000000..55c0285 --- /dev/null +++ b/app/views/contents/_thumb.html.haml @@ -0,0 +1,2 @@ +.fotorama{data:{width:'210px',ratio:"800/600", keyboard: 'true'}} + %a{href: item.src} \ No newline at end of file diff --git a/app/views/contents/_title.html.haml b/app/views/contents/_title.html.haml new file mode 100644 index 0000000..5a8d0f0 --- /dev/null +++ b/app/views/contents/_title.html.haml @@ -0,0 +1,2 @@ += link_to content_base_content_path(item) do + %strong= item.title \ No newline at end of file diff --git a/app/views/contents/index.html.haml b/app/views/contents/index.html.haml index f35d9cc..086f2c3 100644 --- a/app/views/contents/index.html.haml +++ b/app/views/contents/index.html.haml @@ -1,3 +1,5 @@ +- keywords "опубликовать ролик, опубликовать видеоролик, раскрутить видео, поделиться своей работой, обсудить свою работу" +- description "На unbe вы можете поделиться своими видео работами и роликами, получить конструктивную критику и помощь в выполнении своих работ" .row-fluid .span4 %h4.section=title 'Работы' diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index 100a258..50bab74 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -1,3 +1,5 @@ +- keywords "реализовать свой видеопроект, найти людей на свой проект, найти единомышленников в кино, найти режиссера, найти оператора, найти сценариста" +- description "На unbe, в будущем, вы можете создать свой проект и привлечь к его реализации заинтересованных людей и единомышленников, которым интересна индустрия кино" %h4.section= title 'Проекты' %br .projects diff --git a/config/initializers/version.rb b/config/initializers/version.rb index 9938bcf..3d38b19 100644 --- a/config/initializers/version.rb +++ b/config/initializers/version.rb @@ -1,6 +1,6 @@ module MySite class Application - VERSION = "1.0.2" + VERSION = "1.0.3" def self.version "v. #{VERSION}"