diff --git a/app/assets/stylesheets/feeds/index_channel.css b/app/assets/stylesheets/feeds/index_channel.css new file mode 100644 index 0000000..435f52d --- /dev/null +++ b/app/assets/stylesheets/feeds/index_channel.css @@ -0,0 +1,3 @@ +.channel-accordion { + background-color: #fff; +} \ No newline at end of file diff --git a/app/assets/stylesheets/index_channel.css b/app/assets/stylesheets/index_channel.css new file mode 100644 index 0000000..8b9c295 --- /dev/null +++ b/app/assets/stylesheets/index_channel.css @@ -0,0 +1,116 @@ +@import url(https://fonts.googleapis.com/css?family=Roboto); +.channel-accordion { + font-family: 'Roboto', sans-serif; +} + +.channel-accordion-group { + border: none; + border-radius: 2px; + background-color: #fff; + margin-bottom: 10px; +} + +.channel-accordion-heading { + position: relative; +} + +.channel-accordion .channel-accordion-toggle { + background-color: #fff; + font-size: 16px; + padding: 16px; + border: none; + text-decoration: none; + -webkit-transition: .3s all ease-in-out; + -o-transition: .3s all ease-in-out; + transition: .3s all ease-in-out; +} + +.channel-accordion .channel-accordion-toggle:hover { + outline: none; + padding-left: 30px; + color: #fff; + background-color: #08c; +} + +.channel-accordion .channel-accordion-toggle:focus { + outline: none; +} + +.channel-dropdown { + position: absolute; + right: 10px; + top: 12px; +} + +.channel-dropdown-menu { + top: calc(100% + 5px); + right: 0; + left: auto; + z-index: 1200; + border-radius: 4px; + border-color: #ccc; + box-shadow: none; + padding: 20px; +} + +.channel-name { + font-size: 18px; + margin-bottom: 8px; + display: inline-block; +} + +.channel-sublist { + margin: 0; + padding: 0 0 0 10px; + list-style: square; + list-style-position: inside; +} + +.channel-subitem { + padding: 10px 0; + border-top: 1px solid #eee; + overflow: hidden; +} + +.channel-sublist:last-child .channel-subitem { + border-bottom: 1px solid #eee; +} + +.channel-feedname { + font-size: 14px; + display: inline-block; + margin-right: 8px; +} + +.channel-actions { + float: right; +} +.channel-form-horizontal .channel-control-group { + margin-bottom: 8px; +} + +.channel-form-horizontal .channel-label { + float: none; + width: auto; + text-align: left; + display: block; +} + +.channel-form-horizontal .channel-controls { + margin-left: 0; +} + +.channel-source-name { + margin-left: 10px; + vertical-align: middle; +} + + + +/* Utilities */ + +.list-unstyled { + margin: 0; + padding: 0; + list-style: none; +} diff --git a/app/controllers/admin/feeds_controller.rb b/app/controllers/admin/feeds_controller.rb index b5a6dce..1931172 100644 --- a/app/controllers/admin/feeds_controller.rb +++ b/app/controllers/admin/feeds_controller.rb @@ -58,6 +58,15 @@ class Admin::FeedsController < OrbitAdminController render :json => data_to_send.to_json end + def channel_title + site_feeds = SiteFeed.where(:remote_site_url => params["url"]) + site_feeds.each do |sf| + sf.channel_title_translations = params["channel_title_translations"] + sf.save + end + render :json => {"success" => true, "title" => params["channel_title_translations"][I18n.locale.to_s]}.to_json + end + def subscribe site_feed = SiteFeed.new site_feed.remote_site_url = params[:url].chomp("/") diff --git a/app/models/site_feed.rb b/app/models/site_feed.rb index 0f3e109..7abc2eb 100644 --- a/app/models/site_feed.rb +++ b/app/models/site_feed.rb @@ -5,6 +5,7 @@ class SiteFeed field :remote_site_url field :merge_with_category field :channel_name + field :channel_title, :localize => true field :channel_key field :feed_name, localize: true field :disabled, type: Boolean, default: false diff --git a/app/views/admin/feeds/index.html.erb b/app/views/admin/feeds/index.html.erb index 013cedf..783c049 100644 --- a/app/views/admin/feeds/index.html.erb +++ b/app/views/admin/feeds/index.html.erb @@ -1,13 +1,42 @@ +<% content_for :page_specific_css do %> + <%= stylesheet_link_tag "index_channel" %> +<% end %>

Channel and feeds

-
+
<% @school_urls.each_with_index do |url,index| %> -
-
- - <%= (index + 1).to_s %>. <%= url %> +
+
@@ -15,12 +44,18 @@ channel_names = channels.keys channel_names.each do |name| %> -
    -
  • - <%= name %> +
      +
    • + <%= name %> <% channels[name].each do |channel| %> -
        -
      • <%= channel.feed_name %>
      • +
          +
        • + <%= channel.feed_name %> + + + + +
        <% end %> @@ -61,6 +96,26 @@ }) }) + $(".channel-edit-form").on("click",function(){ + var edit = $(this), + save = $(this).next(); + edit.addClass("hide"); + save.removeClass("hide"); + $(document).one("click",function(){ + edit.removeClass("hide"); + save.addClass("hide"); + }) + }) + + $(".channel-save-form").on("click",function(){ + var save = $(this), + edit = $(this).prev(), + form = $(this).parent().find("form"); + edit.removeClass("hide"); + save.addClass("hide"); + form.submit(); + }) + $(".unsubscribe-btn").on("click",function(){ var el = $(this); if(confirm("Are you sure, you want to unsubscribe from " + el.data("feed-name"))){ diff --git a/config/routes.rb b/config/routes.rb index 1cbb30b..f949465 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,6 +10,7 @@ Rails.application.routes.draw do post "/feeds/subscribe", to: 'feeds#subscribe' post "/feeds/unsubscribe", to: 'feeds#unsubscribe' post "/feeds/disable", to: 'feeds#disable' + post "/feeds/channel_title", to: 'feeds#channel_title' resources :feeds end end diff --git a/tmp/install_bash b/tmp/install_bash deleted file mode 100644 index e69de29..0000000