Navigation Menu

Skip to content
This repository has been archived by the owner on Mar 27, 2022. It is now read-only.

Commit

Permalink
Update news section.
Browse files Browse the repository at this point in the history
  • Loading branch information
seven1m committed May 26, 2014
1 parent 7454b86 commit a8fcbc1
Show file tree
Hide file tree
Showing 26 changed files with 10,338 additions and 111 deletions.
5 changes: 5 additions & 0 deletions app/assets/javascripts/editor.js.coffee
@@ -0,0 +1,5 @@
#= require wysihtml5-0.3.0
#= require bootstrap3-wysihtml5

$('.editor-control').wysihtml5
stylesheets: []
2 changes: 2 additions & 0 deletions app/assets/stylesheets/editor.css.scss
@@ -0,0 +1,2 @@
//= require bootstrap-wysihtml5
//= require bootstrap3-wysiwyg5-color
2 changes: 2 additions & 0 deletions app/helpers/nav_helper.rb
Expand Up @@ -68,6 +68,8 @@ def crumbs
crumbs << ['fa fa-gear', t('nav.admin'), admin_path]
elsif params[:controller] == 'searches'
crumbs << ['fa fa-archive', t('nav.directory')]
elsif params[:controller] == 'news' and params[:action] != 'index'
crumbs << ['fa fa-bullhorn', t('news.heading'), news_path]
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions app/views/layouts/default.html.haml
Expand Up @@ -9,6 +9,7 @@
%meta{content: "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no", name: "viewport"}
= yield(:meta)
= stylesheet_link_tag 'application'
= yield(:css)
= csrf_meta_tags
%link{href: "//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,300italic,400italic,600italic|Abel", rel: "stylesheet"}
/[if lt IE 9]
Expand Down Expand Up @@ -138,3 +139,4 @@
= flash_messages
= yield
= javascript_include_tag 'application'
= yield(:js)
2 changes: 2 additions & 0 deletions app/views/layouts/signed_out.html.haml
Expand Up @@ -9,6 +9,7 @@
%meta{content: "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no", name: "viewport"}
= yield(:meta)
= stylesheet_link_tag 'application'
= yield(:css)
= csrf_meta_tags
%link{href: "//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,300italic,400italic,600italic|Abel", rel: "stylesheet"}
/[if lt IE 9]
Expand All @@ -34,3 +35,4 @@
%h2= @title
= content
= javascript_include_tag 'application'
= yield(:js)
24 changes: 0 additions & 24 deletions app/views/news/_form.html.erb

This file was deleted.

23 changes: 23 additions & 0 deletions app/views/news/_form.html.haml
@@ -0,0 +1,23 @@
.row
.col-lg-6
= form_for @news_item do |form|
.form-group
= form.label :title, t('news.title_description')
= form.text_field :title, class: 'form-control'
.form-group
= form.label :body, t('news.body_description')
= form.text_area :body, rows: 10, cols: 100, class: 'form-control editor-control'
.form-group
- if @logged_in.can_edit?(@news_item)
.pull-right
= link_to @news_item, method: 'delete', data: { confirm: t('are_you_sure') }, class: 'btn btn-danger' do
= icon 'fa fa-trash-o'
= t('news.delete_button')
= button_tag class: 'btn btn-success' do
= @news_item.new_record? ? t('news.submit_news') : t('news.save_news')

- content_for :css do
= stylesheet_link_tag 'editor'

- content_for :js do
= javascript_include_tag 'editor'
9 changes: 0 additions & 9 deletions app/views/news/_news_item.html.erb

This file was deleted.

11 changes: 11 additions & 0 deletions app/views/news/_news_item.html.haml
@@ -0,0 +1,11 @@
.news-item.box.box-info
.box-header
%h3.box-title= link_to news_item.title, news_item, class: 'no-underline'
- if @logged_in.can_edit?(news_item)
.box-tools.pull-right
= link_to edit_news_item_path(news_item), class: 'btn bg-gray btn-xs' do
= icon 'fa fa-pencil'
.box-body
= sanitize_html news_item.body
.box-footer
= render partial: 'news_item_meta', locals: {news_item: news_item, controls: false}
16 changes: 0 additions & 16 deletions app/views/news/_news_item_meta.html.erb

This file was deleted.

6 changes: 6 additions & 0 deletions app/views/news/_news_item_meta.html.haml
@@ -0,0 +1,6 @@
.news-item-meta
posted #{news_item.published.to_s(:date) rescue '?'}
- if news_item.person
by #{link_to news_item.person.name, news_item.person}
- elsif news_item.link.to_s.any?
from #{link_to news_item.link.sub(/^http:\/\//, ''), news_item.link}
3 changes: 0 additions & 3 deletions app/views/news/edit.html.erb

This file was deleted.

3 changes: 3 additions & 0 deletions app/views/news/edit.html.haml
@@ -0,0 +1,3 @@
- @title = t('news.edit.heading')

= render partial: 'form'
28 changes: 0 additions & 28 deletions app/views/news/index.html.erb

This file was deleted.

26 changes: 26 additions & 0 deletions app/views/news/index.html.haml
@@ -0,0 +1,26 @@
- content_for :meta do
%link{rel: 'alternate', type: 'application/atom+xml', title: t('news.news_feed'), href: news_url(format: 'xml', code: @logged_in.feed_code)}

- @title = t('news.heading')

.row
.col-md-6
= t('news.welcome_to_the_place')
- if Setting.get(:features, :news_by_users)
= t('news.if_you_have_something_to_share_html', url: new_news_item_path)
.col-md-6
.pull-right
= t('news.subscribe.description')
= link_to news_path(format: 'xml', code: @logged_in.feed_code), class: 'btn bg-orange' do
= icon 'fa fa-rss'
= t('news.subscribe.button')

.row
.col-md-12
= pagination @news_items
= render partial: 'news_item', collection: @news_items
= pagination @news_items

- unless @news_items.any?
%p
%em= t('news.no_news_is_available')
3 changes: 0 additions & 3 deletions app/views/news/new.html.erb

This file was deleted.

3 changes: 3 additions & 0 deletions app/views/news/new.html.haml
@@ -0,0 +1,3 @@
- @title = t('news.submit_news')

= render partial: 'form'
12 changes: 0 additions & 12 deletions app/views/news/show.html.erb

This file was deleted.

15 changes: 15 additions & 0 deletions app/views/news/show.html.haml
@@ -0,0 +1,15 @@
- @title = @news_item.title

.panel
.panel-body
- if @logged_in.can_edit?(@news_item)
.pull-right
= link_to edit_news_item_path(@news_item), class: 'btn btn-xs btn-info' do
= icon 'fa fa-pencil'
= t('news.edit_button')
= link_to news_item_path(@news_item), class: 'btn btn-xs bg-gray text-red', method: 'delete', confirm: t('are_you_sure') do
= icon 'fa fa-trash-o'
= t('news.delete_button')
= render partial: 'news_item_meta', object: @news_item, as: :news_item

.news-item= sanitize_html @news_item.body
4 changes: 4 additions & 0 deletions config/application.rb
Expand Up @@ -37,6 +37,10 @@ class Application < Rails::Application
# Disable implicit join references in ActiveRecord
config.active_record.disable_implicit_join_references = true

# Additional precompiled assets
config.assets.precompile += ['editor.js.coffee']
config.assets.precompile += ['editor.css.scss']

config.generators do |g|
g.test_framework :rspec
end
Expand Down
16 changes: 0 additions & 16 deletions config/locales/en.yml
Expand Up @@ -978,22 +978,6 @@ en:
to_show_the_entire_message: to show the entire message.
unknown_type: Unknown message type.

news:
body_description: "Share your announcement, information, or news here:"
deleted: News deleted.
edit_news_post: Edit News Post
if_you_have_something_to_share_html: If you have something newsworthy to share, <a href="%{url}">submit it here</a>.
news: News
news_feed: News Feed
no_news_is_available: No news is available at this time.
return_to_news: « Return to News
save_news: Save News
saved: News saved.
submit_news: Submit News
subscribe_to_community_news_html: <a href="%{url}" class="feed-icon">Subscribe</a> to Community News with your feed reader.
title_description: "Give your post a concise title:"
welcome_to_the_place: Welcome to the place for community news.

notes:
about_this_note: about this note
add_a_note: Add a Note
Expand Down
21 changes: 21 additions & 0 deletions config/locales/en/news.yml
@@ -0,0 +1,21 @@
en:

news:
heading: "News"
edit:
heading: "Edit News Post"
edit_button: "Edit"
delete_button: "Delete"
body_description: "Share your announcement, information, or news here:"
deleted: "News deleted."
if_you_have_something_to_share_html: "If you have something newsworthy to share, <a href='%{url}'>submit it here</a>."
news_feed: "News Feed"
no_news_is_available: "No news is available at this time."
save_news: "Save News"
saved: "News saved."
submit_news: "Submit News"
subscribe:
button: "Subscribe"
description: "Get news updates in your feed reader."
title_description: "Give your post a concise title:"
welcome_to_the_place: "Welcome to the place for community news."

0 comments on commit a8fcbc1

Please sign in to comment.