update table styles

This commit is contained in:
Lee Lawlor 2014-07-31 15:35:21 -04:00
parent bef9ba1f88
commit 5eb5e231d7
19 changed files with 156 additions and 116 deletions

View File

@ -25,5 +25,8 @@ $(document).on('page:load ready', function() {
$('#contact_form').toggle(); $('#contact_form').toggle();
}); });
// activate any tablesorters
$('.tablesorter').tablesorter();
}); });

View File

@ -70,6 +70,11 @@ class UsersController < ApplicationController
options = authenticated ? User.private_options : User.public_options(@user) options = authenticated ? User.private_options : User.public_options(@user)
end end
# if html request
if request.format == :html
@channels = @user.channels.public_viewable.paginate :page => params[:page], :order => 'last_entry_id DESC'
end
respond_to do |format| respond_to do |format|
format.html format.html
format.json { render :json => @user.as_json(options) } format.json { render :json => @user.as_json(options) }

View File

@ -8,5 +8,15 @@ module ApplicationHelper
return number.to_s.gsub(/,/, '.').to_f return number.to_s.gsub(/,/, '.').to_f
end end
# shortcut for capitalize
def T(symbol)
t(symbol).capitalize
end
# shortcut for titleize
def TT(symbol)
t(symbol).titleize
end
end end

View File

@ -72,7 +72,7 @@ class Channel < ActiveRecord::Base
before_destroy :delete_feeds before_destroy :delete_feeds
validates :video_type, :presence => true, :if => lambda{ |channel| !channel.video_id.nil? && !channel.video_id.empty?} validates :video_type, :presence => true, :if => lambda{ |channel| channel.video_id.present? }
scope :public_viewable, lambda { where("public_flag = true AND social != true") } scope :public_viewable, lambda { where("public_flag = true AND social != true") }
scope :not_social, lambda { where("social != true") } scope :not_social, lambda { where("social != true") }
@ -101,19 +101,19 @@ class Channel < ActiveRecord::Base
# select options # select options
def select_options(options = nil) def select_options(options = nil)
only = [:name, :created_at, :updated_at, :id, :last_entry_id] only = [:name, :created_at, :updated_at, :id, :last_entry_id]
only += [:description] unless self.description.blank? only += [:description] if self.description.present?
only += [:metadata] if options.present? && options[:metadata] == 'true' only += [:metadata] if options.present? && options[:metadata] == 'true'
only += [:latitude] unless self.latitude.blank? only += [:latitude] if self.latitude.present?
only += [:longitude] unless self.longitude.blank? only += [:longitude] if self.longitude.present?
only += [:elevation] unless self.elevation.blank? only += [:elevation] if self.elevation.present?
only += [:field1] unless self.field1.blank? only += [:field1] if self.field1.present?
only += [:field2] unless self.field2.blank? only += [:field2] if self.field2.present?
only += [:field3] unless self.field3.blank? only += [:field3] if self.field3.present?
only += [:field4] unless self.field4.blank? only += [:field4] if self.field4.present?
only += [:field5] unless self.field5.blank? only += [:field5] if self.field5.present?
only += [:field6] unless self.field6.blank? only += [:field6] if self.field6.present?
only += [:field7] unless self.field7.blank? only += [:field7] if self.field7.present?
only += [:field8] unless self.field8.blank? only += [:field8] if self.field8.present?
# return a hash # return a hash
return { :only => only } return { :only => only }
@ -205,41 +205,35 @@ class Channel < ActiveRecord::Base
end end
end end
def private_windows *hidden # private windows
if hidden.size >= 1 def private_windows(show_flag = false)
return windows.where("private_flag = true and show_flag = #{hidden[0].to_s}") show_flag = (show_flag.to_s == 'true') ? true : false
else return self.windows.where("private_flag = true AND show_flag = ?", show_flag)
return windows.where("private_flag = true" )
end
end end
# overloaded version witthout private/public flag for the has_many dependent destroy action # public windows
def public_windows hidden def public_windows(show_flag = false)
return windows.where("private_flag = false and show_flag = #{hidden}") show_flag = (show_flag.to_s == 'true') ? true : false
end return self.windows.where("private_flag = false AND show_flag = ?", show_flag)
# measure of activity in terms of feeds per time period
def public?
return public_flag
end end
# check if the channel is public
def public?; self.public_flag; end
# check if the video has changed
def video_changed? def video_changed?
video_id_changed? || video_type_changed? video_id_changed? || video_type_changed?
end end
# check if the location has changed
def location_changed? def location_changed?
latitude_changed? || longitude_changed? latitude_changed? || longitude_changed?
end end
def feeds_changed? # check if the any of the fields have changed
field1_changed? || def fields_changed?
field2_changed? || field1_changed? || field2_changed? || field3_changed? || field4_changed? ||
field3_changed? || field5_changed? || field6_changed? || field7_changed? || field8_changed?
field4_changed? ||
field5_changed? ||
field6_changed? ||
field7_changed? ||
field8_changed?
end end
def update_chart_portlets def update_chart_portlets
@ -473,9 +467,7 @@ class Channel < ActiveRecord::Base
update_status_portlet false update_status_portlet false
# does channel have a window for every chart element # does channel have a window for every chart element
if feeds_changed? update_chart_portlets if fields_changed?
update_chart_portlets
end
end end
private private

View File

@ -1,9 +1,9 @@
<div class="FL"> <div class="FL">
<h3><%= t(:api_key_write) %></h3> <h3><%= t(:api_key_write) %></h3>
<%= @write_key %> <code class="large"><%= @write_key %></code>
<br><br> <br><br>
<%= button_to t(:api_key_write_new), channel_api_keys_path(@channel, :write => 1), :data => { :confirm => t(:confirm_new_api_key) } %> <%= button_to t(:api_key_write_new), channel_api_keys_path(@channel, :write => 1), :data => { :confirm => t(:confirm_new_api_key) }, class: 'btn btn-warning btn-sm' %>
<br><br> <br><br>
@ -12,7 +12,7 @@
<table> <table>
<tr> <tr>
<td><%= t(:api_key_key) %>:</td> <td><%= t(:api_key_key) %>:</td>
<td><%= read_key %></td> <td><code class="large"><%= read_key %></code></td>
</tr> </tr>
<tr> <tr>
<td class="VAT"><%= t(:note) %>:</td> <td class="VAT"><%= t(:note) %>:</td>
@ -24,16 +24,16 @@
<tr> <tr>
<td></td> <td></td>
<td> <td>
<div class="FL"><%= f.submit t(:note_save) %></div> <div class="FL"><%= f.submit t(:note_save), class: 'btn btn-primary btn-sm btn-margin' %></div>
<% end %> <% end %>
<%= button_to t(:api_key_delete), channel_api_key_path(@channel, read_key), :method => 'delete', :data => { :confirm => t(:confirm_read_key_delete) } %></td> <%= button_to t(:api_key_delete), channel_api_key_path(@channel, read_key), :method => 'delete', :data => { :confirm => t(:confirm_read_key_delete) }, class: 'btn btn-danger btn-sm btn-margin' %></td>
</tr> </tr>
</table> </table>
<br><br> <br><br>
<% end %> <% end %>
<%= button_to t(:api_key_read_new), channel_api_keys_path(@channel, :write => 0) %> <%= button_to t(:api_key_read_new), channel_api_keys_path(@channel, :write => 0), class: 'btn btn-warning btn-sm' %>
<br> <br>
</div> </div>
<div id="sidebar_old"> <div id="sidebar_old">

View File

@ -5,6 +5,8 @@
<div class="col-pad" data-no-turbolink> <div class="col-pad" data-no-turbolink>
<%= button_to t(:channel_create), channels_path, :method => :post, :class => 'btn btn-primary' %><br>
<% if @channels.length > 0 %> <% if @channels.length > 0 %>
<table class="table table-striped table-bordered tablesorter"> <table class="table table-striped table-bordered tablesorter">
@ -19,16 +21,19 @@
<tr> <tr>
<td> <td>
<h4 style="margin-top: 0;">
<a href="/channels/<%= channel.id %>"> <a href="/channels/<%= channel.id %>">
<i class="fa fa-<%= 'un' if channel.public_flag == true %>lock fa-fw"></i> <i class="fa fa-<%= 'un' if channel.public_flag == true %>lock fa-fw"></i>
<%= channel.name %> <%= channel.name %>
</a> </a>
<br> </h4>
<%= link_to t(:private_link), channel_path(channel.id, :anchor => 'privateview') %> | <div class="btn-group btn-group-sm hidden-xs hidden-sm">
<%= link_to t(:public_link), channel_path(channel.id, :anchor => 'publicview') %> | <%= link_to t(:private_link), channel_path(channel.id, :anchor => 'privateview'), class: 'btn btn-default' %>
<%= link_to t(:settings_link), channel_path(channel.id, :anchor => 'channelsettings') %> | <%= link_to t(:public_link), channel_path(channel.id, :anchor => 'publicview'), class: 'btn btn-default' %>
<%= link_to t(:api_key_link), channel_path(channel.id, :anchor => 'apikeys') %> | <%= link_to t(:settings_link), channel_path(channel.id, :anchor => 'channelsettings'), class: 'btn btn-default' %>
<%= link_to t(:data_import_link), channel_path(channel.id, :anchor => 'dataimport') %> <%= link_to t(:api_key_link), channel_path(channel.id, :anchor => 'apikeys'), class: 'btn btn-default' %>
<%= link_to t(:data_import_link), channel_path(channel.id, :anchor => 'dataimport'), class: 'btn btn-default' %>
</div>
</td> </td>
<td><%= channel.created_at.strftime("%Y-%m-%d") %></td> <td><%= channel.created_at.strftime("%Y-%m-%d") %></td>
@ -38,8 +43,6 @@
</table> </table>
<% end %> <% end %>
<%= button_to t(:channel_create), channels_path, :method => :post, :class => 'btn btn-primary' %>
<% if current_admin_user.present? %> <% if current_admin_user.present? %>
<br><br><br> <br><br><br>
<% @channels.each do |c| %> <% @channels.each do |c| %>
@ -72,9 +75,3 @@
</div> </div>
<script>
$(document).on('page:load ready', function() {
$('.tablesorter').tablesorter();
});
</script>

View File

@ -3,36 +3,43 @@
<h4 class='breadcrumb'><%= t(:plugins) %></h4> <h4 class='breadcrumb'><%= t(:plugins) %></h4>
<% if @plugins.length > 0 %>
<table class="table table-striped table-bordered">
<tr>
<th><%= t(:plugin_name) %></th>
<th><%= t(:action) %></th>
</tr>
<% @plugins.each do |p| %>
<tr>
<td>
<i class="fa fa-<%= 'un' if p.private_flag != true %>lock fa-fw"></i>
<%= p.name %>
</td>
<td>
<%= link_to t(:view).downcase, plugin_path(p.id), :target => '_blank' %>
&nbsp;
<%= link_to t(:edit).downcase, edit_plugin_path(p.id) %>
</td>
</tr>
<% end %>
</table>
<br><br>
<% end %>
<%= form_for :plugin do |p| %> <%= form_for :plugin do |p| %>
<input name='userlogin' class='userlogin' /> <input name='userlogin' class='userlogin' />
<%= p.submit t(:plugin_create), :class => 'btn btn-primary' %> <%= p.submit t(:plugin_create), :class => 'btn btn-primary' %>
<% end %> <% end %>
<br>
<% if @plugins.length > 0 %>
<table class="table table-striped table-bordered tablesorter">
<thead>
<tr>
<th><%= t(:plugin_name) %> <i class="fa fa-unsorted"></i></th>
<th><%= t(:created) %> <i class="fa fa-unsorted"></i></td>
</tr>
</thead>
<tbody>
<% @plugins.each do |p| %>
<tr>
<td>
<h4 style="margin-top: 0;">
<a href="<%= plugin_path(p.id) %>" target="_blank">
<i class="fa fa-<%= 'un' if p.private_flag != true %>lock fa-fw"></i>
<%= p.name %>
</a>
</h4>
<div class="btn-group btn-group-sm">
<%= link_to T(:view), plugin_path(p.id), :target => '_blank', class: 'btn btn-default' %>
<%= link_to T(:edit), edit_plugin_path(p.id), class: 'btn btn-default' %>
</div>
</td>
<td><%= p.created_at.strftime("%Y-%m-%d") %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
</div> </div>
<div id="sidebar" class="col-xs-12 col-sm-6"> <div id="sidebar" class="col-xs-12 col-sm-6">

View File

@ -0,0 +1,37 @@
<h3><%= t(:user_public_channels) %> <%= @user.login %></h3>
<% if @channels.present? && @channels.count > 0 %>
<table class="table table-striped table-bordered tablesorter">
<thead>
<tr>
<th class="col-sm-5 col-xs-5"><%= t(:channel_name) %> <i class="fa fa-unsorted"></i></th>
<th class="col-sm-5 col-xs-5"><%= t(:channel_description) %> <i class="fa fa-unsorted"></i></td>
<th class="col-sm-2 col-xs-2"><%= t(:tags) %> <i class="fa fa-unsorted"></i></td>
</tr>
</thead>
<tbody>
<% @channels.each do |channel| %>
<tr>
<td>
<h4 style="margin-top: 0;">
<%= link_to channel.name, channel_path(channel.id) %>
</h4>
<%= link_to T(:view), channel_path(channel.id), class: 'btn btn-default btn-sm' %>
<td><%= channel.description %></td>
<td>
<% channel.tags.each do |tag| %>
<a href="/channels/public?tag=<%=u tag.name %>"><%= tag.name %></a><% unless tag == channel.tags.last %>, <% end %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= will_paginate @channels %>
<% else %>
<%= t(:user_no_public_channels) %>
<% end %>

View File

@ -1,19 +1,2 @@
<h3><%= t(:user_public_channels) %> <%= @user.login %></h3> <%= render 'list_channels' %>
<% if @channels.present? && @channels.count > 0 %>
<table class="table table-striped table-bordered">
<tr><th><%= t(:channel_name) %></th><th><%= t(:channel_description) %></th><th><%= t(:tags) %></th></tr>
<% @channels.each do |m| %>
<tr<%= cycle('', raw(' class="stripe"')) %>>
<td><%= link_to m.name, channel_path(m.id) %></td>
<td><%= m.description %></td>
<td><%= m.list_tags %></td>
</tr>
<% end %>
</table>
<br>
<%= will_paginate @channels %>
<% else %>
<%= t(:user_no_public_channels) %>
<% end %>

View File

@ -6,14 +6,15 @@
</div> </div>
<h2><%= t(:profile_for) %> <%= @user.login %></h2> <h2><%= t(:profile_for) %> <%= @user.login %></h2>
<%= link_to t(:channels_public_view), list_channels_path(@user.login) %>
<br><br>
<%= t(:member_since) %> <%= @user.created_at.strftime('%B %-d, %Y') %> <%= t(:member_since) %> <%= @user.created_at.strftime('%B %-d, %Y') %>
<br><br> <br><br>
<%= t(:profile_website) %>: <%= link_to @user.website, @user.website %> <%= t(:profile_website) %>: <%= link_to @user.website, @user.website %>
<br><br> <br><br>
<%= t(:profile_bio) %>: <%= @user.bio %> <%= t(:profile_bio) %>: <%= @user.bio %>
<br><br>
<%= render 'list_channels' %>
<% else %> <% else %>
<%= t(:profile_not_public) %> <%= t(:profile_not_public) %>
<% end %> <% end %>

View File

@ -21,8 +21,8 @@
<tr> <tr>
<td><%= t(:api_key) %></td> <td><%= t(:api_key) %></td>
<td> <td>
<%= @user.api_key %><br> <code><%= @user.api_key %></code><br><br>
<%= button_to t(:api_key_new), user_new_api_key_path, :data => { :confirm => t(:confirm_new_user_api_key) }, :class => 'btn btn-primary btn-sm' %> <%= button_to t(:api_key_new), user_new_api_key_path, :data => { :confirm => t(:confirm_new_user_api_key) }, :class => 'btn btn-warning btn-sm' %>
</td> </td>
</tr> </tr>

View File

@ -93,6 +93,7 @@ en:
confirm_new_thingtweet_key: "Are you sure you want to generate a new ThingTweet API key?" confirm_new_thingtweet_key: "Are you sure you want to generate a new ThingTweet API key?"
confirm_new_user_api_key: "Are you sure you want to generate a new API key?" confirm_new_user_api_key: "Are you sure you want to generate a new API key?"
confirm_plugin_delete: "Are you sure you want to delete this plugin?" confirm_plugin_delete: "Are you sure you want to delete this plugin?"
confirm_react_delete: "Are you sure you want to delete this React?"
confirm_talkback_delete: "Are you sure you want to delete this TalkBack?" confirm_talkback_delete: "Are you sure you want to delete this TalkBack?"
confirm_thinghttp_delete: "Are you sure you want to delete this ThingHTTP?" confirm_thinghttp_delete: "Are you sure you want to delete this ThingHTTP?"
confirm_tweetcontrol_delete: "Are you sure you want to delete this TweetControl?" confirm_tweetcontrol_delete: "Are you sure you want to delete this TweetControl?"
@ -202,6 +203,7 @@ en:
react: "React" react: "React"
react_header_name: "Name" react_header_name: "Name"
react_new_button: "Create New React" react_new_button: "Create New React"
react_delete: "Delete React"
react_delete_confirm: "Are you sure you wish to delete this condition?" react_delete_confirm: "Are you sure you wish to delete this condition?"
react_thinghttp_error: "'%{thinghttp_name}' request doesn't belong to you" react_thinghttp_error: "'%{thinghttp_name}' request doesn't belong to you"
react_thingtweet_error: "'%{twitter_account_name}' Twitter account doesn't belong to you" react_thingtweet_error: "'%{twitter_account_name}' Twitter account doesn't belong to you"
@ -247,6 +249,7 @@ en:
react_thinghttp_delete_warning1: "Cannot delete this ThingHTTP as it is used by %{reacts_count}: %{reacts_list}" react_thinghttp_delete_warning1: "Cannot delete this ThingHTTP as it is used by %{reacts_count}: %{reacts_list}"
react_thinghttp_delete_warning2: "Please delete or modify this react before unlinking this ThingHTTP." react_thinghttp_delete_warning2: "Please delete or modify this react before unlinking this ThingHTTP."
react_default_name: "React" react_default_name: "React"
react_delete_message: "Want to delete this React?"
react_label_condition: "Condition" react_label_condition: "Condition"
react_label_test_frequency: "Test Frequency" react_label_test_frequency: "Test Frequency"
react_label_react_name: "React Name" react_label_react_name: "React Name"

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long