@@ -33,6 +33,28 @@ class SubscriptionsController < ApplicationController | |||||
end | end | ||||
end | end | ||||
# GET /subscriptions/1/edit | |||||
def edit | |||||
@subscription = Subscription.find(params[:id]) | |||||
end | |||||
# PUT /subscriptions/1 | |||||
# PUT /subscriptions/1.json | |||||
def update | |||||
@subscription = Subscription.find(params[:id]) | |||||
respond_to do |format| | |||||
if @subscription.update_attributes(params[:subscription]) | |||||
format.html { redirect_to @subscription.layer, notice: 'Subscription updated OK' } | |||||
format.json { head :no_content } | |||||
else | |||||
format.html { render action: "edit" } | |||||
format.json { render json: @subscription.errors, status: :unprocessable_entity } | |||||
end | |||||
end | |||||
end | |||||
def destroy | def destroy | ||||
@subscription = Subscription.find(params[:id]) | @subscription = Subscription.find(params[:id]) | ||||
@layer = @subscription.layer | @layer = @subscription.layer | ||||
@@ -40,6 +40,7 @@ | |||||
%td= link_to "Fetch", fetch_feed_url(s.feed), :class => "button" | %td= link_to "Fetch", fetch_feed_url(s.feed), :class => "button" | ||||
%td= link_to 'Edit', edit_feed_path(s.feed), :class => "button" | %td= link_to 'Edit', edit_feed_path(s.feed), :class => "button" | ||||
%td= link_to 'Delete', s, :confirm => "Delete #{s.feed.title}?", :method => :delete, :class => "button" | %td= link_to 'Delete', s, :confirm => "Delete #{s.feed.title}?", :method => :delete, :class => "button" | ||||
%td= link_to 'Edit icon', edit_subscription_path(s), :class => "button" | |||||
%tr | %tr | ||||
%td | %td | ||||
@@ -0,0 +1,21 @@ | |||||
%h1 Custom feed icon | |||||
%p | |||||
Layer: | |||||
= link_to @subscription.layer.name, @subscription.layer | |||||
%p Specify the URL for an icon (JPG or PNG image) and it'll display for all posts in this feed in Layar. | |||||
= form_for @subscription do |f| | |||||
-if @subscription.errors.any? | |||||
#error_explanation | |||||
%h2= "#{pluralize(@subscription.errors.count, "error")} prohibited this feed from being saved:" | |||||
%ul | |||||
- @subscription.errors.full_messages.each do |msg| | |||||
%li= msg | |||||
.field | |||||
= f.label "Icon URL" | |||||
= f.text_field :icon_url, :size => 120 | |||||
= f.submit 'Save', :id => 'submit' |
@@ -0,0 +1,3 @@ | |||||
= render 'icon_form' | |||||
= link_to 'Back', layer_path(@subscription.layer) |
@@ -0,0 +1,5 @@ | |||||
class AddIconUrlToSubscriptions < ActiveRecord::Migration | |||||
def change | |||||
add_column :subscriptions, :icon_url, :string | |||||
end | |||||
end |
@@ -11,7 +11,7 @@ | |||||
# | # | ||||
# It's strongly recommended to check this file into your version control system. | # It's strongly recommended to check this file into your version control system. | ||||
ActiveRecord::Schema.define(:version => 20130408142010) do | |||||
ActiveRecord::Schema.define(:version => 20130410153407) do | |||||
create_table "delayed_jobs", :force => true do |t| | create_table "delayed_jobs", :force => true do |t| | ||||
t.integer "priority", :default => 0 | t.integer "priority", :default => 0 | ||||
@@ -66,6 +66,7 @@ ActiveRecord::Schema.define(:version => 20130408142010) do | |||||
t.integer "layer_id" | t.integer "layer_id" | ||||
t.datetime "created_at" | t.datetime "created_at" | ||||
t.datetime "updated_at" | t.datetime "updated_at" | ||||
t.string "icon_url" | |||||
end | end | ||||
add_index "subscriptions", ["feed_id", "layer_id"], :name => "index_feeds_layers_on_feed_id_and_layer_id", :unique => true | add_index "subscriptions", ["feed_id", "layer_id"], :name => "index_feeds_layers_on_feed_id_and_layer_id", :unique => true | ||||