Improve channel, user and api_key models with basic scopes, correct references and protect attributes.
Simplify channels & user controllers and models, moving code to the models. Remove catch-all route and ensure all actions are specified, fixing url paths. Change clone to dup in feed_controller as using clone seems to affect the cloned object (problem only in ruby 1.9.3?)
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
</h2>
|
||||
|
||||
<h3><%= t(:api_key_write) %></h3>
|
||||
<%= @key %>
|
||||
<%= @write_key %>
|
||||
|
||||
<br /><br />
|
||||
|
||||
@ -18,21 +18,21 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= t(:api_key_key) %>:</td>
|
||||
<td><%= read_key.api_key %></td>
|
||||
<td><%= read_key %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="VAT"><%= t(:note) %>:</td>
|
||||
<td>
|
||||
<%= form_for read_key, :as => :api_key, :url => { :controller => 'api_keys', :action => 'update' }, :html => {:method => 'put'} do |f| %>
|
||||
<%= form_for read_key, :as => :api_key, :url => channel_api_key_path(@channel, read_key), :html => {:method => 'put'} do |f| %>
|
||||
<%= f.text_area :note, :cols => 30, :rows => 4 %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.hidden_field :api_key, :value => read_key.api_key %></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="FL"><%= f.submit t(:note_save) %></div>
|
||||
<% end %>
|
||||
<%= button_to t(:api_key_delete), { :controller => 'api_keys', :action => 'destroy', :api_key => read_key.api_key}, :confirm => t(:confirm_read_key_delete) %></td>
|
||||
<%= button_to t(:api_key_delete), channel_api_key_path(@channel, read_key) , :method => 'delete', :confirm => t(:confirm_read_key_delete) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br /><br />
|
||||
|
@ -78,12 +78,12 @@
|
||||
<br /><br />
|
||||
|
||||
<h2><%= t(:channel_clear_message) %></h2>
|
||||
<%= button_to t(:channel_clear), { :controller => 'channels', :action => 'clear', :id => @channel.id }, :confirm => t(:confirm_channel_clear) %>
|
||||
<%= button_to t(:channel_clear), clear_channel_path(@channel), :confirm => t(:confirm_channel_clear) %>
|
||||
|
||||
<br /><br />
|
||||
|
||||
<h2><%= t(:channel_delete_message) %></h2>
|
||||
<%= button_to t(:channel_delete), channel_path(@channel.id), :method => 'delete', :confirm => t(:confirm_channel_delete) %>
|
||||
<%= button_to t(:channel_delete), channel_path(@channel), :method => 'delete', :confirm => t(:confirm_channel_delete) %>
|
||||
|
||||
<script type="text/javascript">
|
||||
// remember default field label
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<%= t(:upload_select) %>
|
||||
<br /><br />
|
||||
<%= form_for :upload, :url => {:controller => 'channels', :action => 'upload', :channel_id => params[:channel_id]}, :html => { :multipart => true } do |f| %>
|
||||
<%= form_for :upload, :url => upload_channel_path(@channel), :html => { :multipart => true } do |f| %>
|
||||
<%= f.file_field :csv %>
|
||||
<br /><br />
|
||||
<%= t(:time_zone) %>
|
||||
|
@ -1,4 +1,5 @@
|
||||
<%= javascript_include_tag 'rest' %>
|
||||
<script type="text/javascript" src="/javascripts/rest.js"></script>
|
||||
|
||||
|
||||
<h2>
|
||||
<%= link_to t(:channels), channels_path %> »
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div id="options">
|
||||
<% if current_user %>
|
||||
<span class="action"> <%= link_to t(:signout), logout_path %></span>
|
||||
<span class="action"> <%= link_to t(:signout), logout_path, :method => 'delete' %></span>
|
||||
<% else %>
|
||||
<span class="action">
|
||||
<%= link_to t(:signup), new_user_path %>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<%= form_for (@user_session = UserSession.new), :url => user_session_path, :html => { :id => 'loginform' } do |f| %>
|
||||
<%= form_for @user_session, :url => user_session_path, :html => { :id => 'loginform' } do |f| %>
|
||||
<input name='userlogin' class='userlogin' />
|
||||
<%= f.hidden_field :remember_me, :value => false %>
|
||||
<table id="login" class="round">
|
||||
@ -21,7 +21,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><%= link_to t(:forgot), forgot_password_path, :id => 'forgot_password' %></td>
|
||||
<td><%= link_to t(:forgot), forgot_password_users_path, :id => 'forgot_password' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<h2><%= t(:password_forgot) %></h2>
|
||||
<%= t(:password_forgot_message) %>
|
||||
<br /><br />
|
||||
<%= form_for @user, :url => { :controller => 'mailer', :action => 'resetpassword' } do |f| %>
|
||||
<%= form_for :user, :url => resetpassword_path do |f| %>
|
||||
<input name='userlogin' class='userlogin' />
|
||||
<%= f.text_field :login %>
|
||||
<%= f.submit t(:submit) %>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<% if @valid_link %>
|
||||
<h2><%= t(:password_new) %></h2>
|
||||
<%= form_for @user, :url => { :controller => 'users', :action => 'change_password', :id => @user.id } do |f| %>
|
||||
<%= form_for @user, :url => change_password_user_path(@user) do |f| %>
|
||||
<%= error_messages_for 'user', :header_message => t(:try_again), :message => t(:password_new_error) %>
|
||||
<input name='userlogin' class='userlogin' />
|
||||
<table class="bigtable">
|
||||
|
Reference in New Issue
Block a user