Skip to content

Commit

Permalink
Started to redo the screen subscriptions views for #35 - we are now g…
Browse files Browse the repository at this point in the history
…oing back to the manage.html.erb views
  • Loading branch information
brzaik committed Apr 23, 2012
1 parent 98acea1 commit e74a6e4
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/application/layout/forms.scss.erb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ textarea,
select,
.uneditable-input {
display: inline-block;
width: 210px;
width: 300px;
height: $baseline;
padding: 4px;
font-size: $basefont;
Expand Down
1 change: 1 addition & 0 deletions app/controllers/screens_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def new
# GET /screens/1/edit
def edit
@screen = Screen.find(params[:id])
@template = Template.new

@templates = Template.all
#@templates_bestfit = Template.find(:all, :conditions => "width / height = #{screen_aspect_ratio}")
Expand Down
1 change: 1 addition & 0 deletions app/controllers/subscriptions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def index

# GET /screen/:screen_id/subscriptions/manage
def manage
@this_field = Field.find(params[:field_id])
@fields = @screen.template.positions.collect{|p| p.field}

respond_to do |format|
Expand Down
1 change: 1 addition & 0 deletions app/views/screens/_show_body.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<% @screen.template.positions.each do |pos| %>
<div class="pos" style="top: <%= pos.top * 100 %>%; left: <%= pos.left * 100 %>%; width: <%= (pos.right - pos.left) * 100 %>%; height: <%= (pos.bottom - pos.top) * 100 %>%; <%= pos.style %>">
<%= pos.id %>
<%= link_to "Change Subscriptions", manage_screen_field_subscriptions_path(@screen, pos.field), :class => "btn info" %>
</div>
<% end %>
</div>
Expand Down
Empty file.
1 change: 1 addition & 0 deletions app/views/subscriptions/_subscription.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= subscription.feed.name %>
13 changes: 6 additions & 7 deletions app/views/subscriptions/manage.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<% @fields.each do |field| %>
<h1><%= field.name %></h1>
<% field.subscriptions.where(:screen_id => @screen.id).each do |subscription| %>
<%= render :partial => 'manage', :locals => {:screen => @screen, :subscription => subscription} %>
<% end %>
<% feeds = Feed.subscribable(@screen, field) %>
<%= render :partial => 'manage', :locals => {:screen => @screen, :subscription => Subscription.new(:field => field), :feeds => feeds} unless feeds.empty? %>
<h1><%= @this_field.name %></h1>
<% @this_field.subscriptions.where(:screen_id => @screen.id).each do |subscription| %>
<%= render subscription %>
<!-- :partial => 'manage', :locals => {:screen => @screen, :subscription => subscription} %> -->
<% end %>
<% feeds = Feed.subscribable(@screen, @this_field) %>
<%#= render :partial => 'manage', :locals => {:screen => @screen, :subscription => Subscription.new(:field => @this_field), :feeds => feeds} unless feeds.empty? %>
10 changes: 6 additions & 4 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@
end

resources :screens do
resources :subscriptions do
collection do
get :manage
put :save
resources :fields do
resources :subscriptions do
collection do
get :manage
put :save
end
end
end
end
Expand Down

0 comments on commit e74a6e4

Please sign in to comment.