mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
Merge branch 'Vincent14-rss_feeds' into dev
This commit is contained in:
commit
8dbbbfad9e
8
.github/ISSUE_TEMPLATE.md
vendored
Normal file
8
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
This issue tracker is **reserved** for bug reports and feature requests.
|
||||
|
||||
The place to ask a question or call for help is at Fab-manager forums at https://forum.fab-manager.com/.
|
||||
|
||||
To report a bug, please describe:
|
||||
- Expected behavior and actual behavior.
|
||||
- Steps to reproduce the problem.
|
||||
- Specifications like the version of the project, operating system, or hardware.
|
@ -90,7 +90,7 @@
|
||||
<div class="card-header-bg" style="background-image: url({{project.project_image}});">
|
||||
<img src="data:image/png;base64," data-src="holder.js/100%x100%/text:/font:FontAwesome/icon" bs-holder ng-if="!project.project_image">
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card-block">
|
||||
|
9
app/controllers/rss/events_controller.rb
Normal file
9
app/controllers/rss/events_controller.rb
Normal file
@ -0,0 +1,9 @@
|
||||
class Rss::EventsController < Rss::RssController
|
||||
|
||||
def index
|
||||
@events = Event.includes(:event_image, :event_files, :availability, :category)
|
||||
.where('availabilities.start_at >= ?', Time.now)
|
||||
.order('availabilities.start_at ASC').references(:availabilities).limit(10)
|
||||
@fab_name = Setting.find_by(name: 'fablab_name').value
|
||||
end
|
||||
end
|
7
app/controllers/rss/projects_controller.rb
Normal file
7
app/controllers/rss/projects_controller.rb
Normal file
@ -0,0 +1,7 @@
|
||||
class Rss::ProjectsController < Rss::RssController
|
||||
|
||||
def index
|
||||
@projects = Project.includes(:project_image, :users).published.order('created_at desc').limit(10)
|
||||
@fab_name = Setting.find_by(name: 'fablab_name').value
|
||||
end
|
||||
end
|
4
app/controllers/rss/rss_controller.rb
Normal file
4
app/controllers/rss/rss_controller.rb
Normal file
@ -0,0 +1,4 @@
|
||||
class Rss::RssController < ApplicationController
|
||||
|
||||
|
||||
end
|
@ -65,6 +65,9 @@
|
||||
<link rel="shortcut icon" type="image/ico" href="<%= CustomAsset.get_url('favicon-file') %>">
|
||||
<% end %>
|
||||
|
||||
<!-- RSS -->
|
||||
<link rel="alternate" type="application/rss+xml" title="RSS: <%= t('app.public.projects_list.the_fablab_projects') %>" href="<%= rss_projects_path %>.xml">
|
||||
<link rel="alternate" type="application/rss+xml" title="RSS: <%= t('app.public.events_list.the_fablab_s_events') %>" href="<%= rss_events_path %>.xml">
|
||||
|
||||
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
|
22
app/views/rss/events/index.xml.builder
Normal file
22
app/views/rss/events/index.xml.builder
Normal file
@ -0,0 +1,22 @@
|
||||
#encoding: UTF-8
|
||||
|
||||
xml.instruct! :xml, version: '1.0'
|
||||
xml.rss version: '2.0' do
|
||||
xml.channel do
|
||||
xml.title "#{t('app.public.events_list.the_fablab_s_events')} - #{@fab_name}"
|
||||
xml.description t('app.public.home.fablab_s_next_events')
|
||||
xml.author @fab_name
|
||||
xml.link root_url + '#!/events'
|
||||
xml.language I18n.locale.to_s
|
||||
|
||||
@events.each do |event|
|
||||
xml.item do
|
||||
xml.guid event.id
|
||||
xml.pubDate event.created_at.strftime('%F %T')
|
||||
xml.title event.name
|
||||
xml.link root_url + '#!/events/' + event.id.to_s
|
||||
xml.description event.description
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
23
app/views/rss/projects/index.xml.builder
Normal file
23
app/views/rss/projects/index.xml.builder
Normal file
@ -0,0 +1,23 @@
|
||||
#encoding: UTF-8
|
||||
|
||||
xml.instruct! :xml, version: '1.0'
|
||||
xml.rss version: '2.0' do
|
||||
xml.channel do
|
||||
xml.title "#{t('app.public.projects_list.the_fablab_projects')} - #{@fab_name}"
|
||||
xml.description t('app.public.home.latest_documented_projects')
|
||||
xml.author @fab_name
|
||||
xml.link root_url + '#!/projects'
|
||||
xml.language I18n.locale.to_s
|
||||
|
||||
@projects.each do |project|
|
||||
xml.item do
|
||||
xml.guid project.id
|
||||
xml.pubDate project.created_at.strftime('%F %T')
|
||||
xml.title project.name
|
||||
xml.link root_url + '#!/projects/' + project.slug
|
||||
xml.author project.author.first_name
|
||||
xml.description project.description
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -132,6 +132,13 @@ Rails.application.routes.draw do
|
||||
get 'version' => 'version#show'
|
||||
end
|
||||
|
||||
# rss
|
||||
|
||||
namespace :rss, as: nil, defaults: { format: :xml } do
|
||||
resources :projects, only: [:index], as: 'rss_projects'
|
||||
resources :events, only: [:index], as: 'rss_events'
|
||||
end
|
||||
|
||||
# open_api
|
||||
|
||||
namespace :open_api do
|
||||
|
Loading…
x
Reference in New Issue
Block a user