Modify layout
This commit is contained in:
parent
3445cb8e69
commit
9933db4fb5
|
@ -1,22 +1,22 @@
|
||||||
<br/>
|
<legend><h3 style="margin-left: 10px;"><%= t('feed.channel') %></h3></legend>
|
||||||
<h2><%= t('feed.channel') %></h2>
|
<fieldset style="margin-left: -50px;">
|
||||||
|
<div class="control-group">
|
||||||
<div class="control-group">
|
<label class="control-label" for="inputName"><%= t('feed.enter') + " RSS " + t('feed.name')%>:</label>
|
||||||
<label class="control-label" for=""><%= t('feed.enter')+" RSS "+t('feed.name')%></label>
|
<div class="controls">
|
||||||
<div class="controls">
|
<%= f.text_field :name, :class => 'span4', :placeholder => 'RSS ' + t('feed.name'), :id => "inputName" %>
|
||||||
<%= f.text_field :name, :class=>'span4', :placeholder => 'RSS '+t('feed.name')%>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for=""><%= t('feed.enter')+" RSS URL" %></label>
|
<label class="control-label" for="inputURL"><%= t('feed.enter') + " RSS URL" %>:</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.text_field :link, :class=>'span4', :placeholder => 'RSS URL'%>
|
<%= f.text_field :link, :class => 'span4', :placeholder => 'RSS URL', :id => "inputURL"%>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.submit t("submit"), :class=>"btn" %>
|
<%= f.submit t("submit"), :class => "btn btn-primary" %>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
|
@ -1,3 +1,3 @@
|
||||||
<%= form_for @feed, :url => panel_feed_back_end_feed_path, :method => :put, :html => { :class=>"form-horizontal"} do |f| %>
|
<%= form_for @feed, :url => panel_feed_back_end_feed_path, :method => :put, :html => {:class => "form-horizontal"} do |f| %>
|
||||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
<% end %>
|
<% end %>
|
|
@ -1,7 +1,6 @@
|
||||||
<br/>
|
|
||||||
<h3><%= t('feed.channel') %></h3>
|
|
||||||
<table class="table main-list">
|
<table class="table main-list">
|
||||||
<thead>
|
<thead>
|
||||||
|
<tr><th><h3><%= t('feed.channel') %></h3></th></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="span4"><%= t('RSS') %></th>
|
<th class="span4"><%= t('RSS') %></th>
|
||||||
<%if is_manager? %>
|
<%if is_manager? %>
|
||||||
|
@ -16,12 +15,13 @@
|
||||||
<td><%= feed.name %></td>
|
<td><%= feed.name %></td>
|
||||||
<%if is_manager? %>
|
<%if is_manager? %>
|
||||||
<td><%= link_to t('feed.edit'), edit_panel_feed_back_end_feed_path(feed) %></td>
|
<td><%= link_to t('feed.edit'), edit_panel_feed_back_end_feed_path(feed) %></td>
|
||||||
<td><%= link_to t('feed.cancel'), panel_feed_back_end_feed_path(feed), method: :delete , :confirm => t(:sure?) %></td>
|
<td><%= link_to t('feed.cancel'), panel_feed_back_end_feed_path(feed), method: :delete, confirm: t(:sure?) %></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<%if is_manager? %>
|
<%if is_manager? %>
|
||||||
<%= link_to t('feed.new'), new_panel_feed_back_end_feed_path, :class => "btn btn-primary pull-right", :id=>"create_event_btn", :ref=>"add-btn" %>
|
<br />
|
||||||
|
<%= link_to t('feed.new'), new_panel_feed_back_end_feed_path, :class => "btn btn-primary pull-right", :id => "create_event_btn", :ref => "add-btn" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -3,12 +3,12 @@ require 'rss'
|
||||||
require 'mongo'
|
require 'mongo'
|
||||||
|
|
||||||
|
|
||||||
#base on your DB
|
# Change this according to local DB
|
||||||
DB_BASE_NAME = "production_0"
|
DB_BASE_NAME = "production_0"
|
||||||
|
|
||||||
#create a hash rss site list from mongodb
|
# Create a hash rss site list from mongodb
|
||||||
db = Mongo::Connection.new("localhost", 27017).db("#{DB_BASE_NAME}")
|
db = Mongo::Connection.new("localhost", 27017).db("#{DB_BASE_NAME}")
|
||||||
SITES = Hash[ db["announcement_feeds"].find().entries.collect { |f| [ f["name"], f["link"] ]} ]
|
SITES = Hash[ db["announcement_feeds"].find().entries.collect {|f| [ f["name"], f["link"] ]} ]
|
||||||
|
|
||||||
yesterday = Time.now - 86400
|
yesterday = Time.now - 86400
|
||||||
two_weeks_ago = Time.new - 60 * 60 * 24 * 14
|
two_weeks_ago = Time.new - 60 * 60 * 24 * 14
|
||||||
|
@ -18,7 +18,7 @@ recent_feed = {}
|
||||||
SITES.each do |name, url|
|
SITES.each do |name, url|
|
||||||
open("http://#{url}/panel/announcement/front_end/bulletins.rss?inner=true") do |rss|
|
open("http://#{url}/panel/announcement/front_end/bulletins.rss?inner=true") do |rss|
|
||||||
|
|
||||||
# Giving false parameter is for skipping irregular format of the RSS
|
# Giving 'false' parameter is for skipping irregular format of the RSS
|
||||||
feed = RSS::Parser.parse(rss, false)
|
feed = RSS::Parser.parse(rss, false)
|
||||||
|
|
||||||
feed.items.each do |item|
|
feed.items.each do |item|
|
||||||
|
|
Loading…
Reference in New Issue