update table styles
This commit is contained in:
@ -25,5 +25,8 @@ $(document).on('page:load ready', function() {
|
||||
$('#contact_form').toggle();
|
||||
});
|
||||
|
||||
// activate any tablesorters
|
||||
$('.tablesorter').tablesorter();
|
||||
|
||||
});
|
||||
|
||||
|
@ -70,6 +70,11 @@ class UsersController < ApplicationController
|
||||
options = authenticated ? User.private_options : User.public_options(@user)
|
||||
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|
|
||||
format.html
|
||||
format.json { render :json => @user.as_json(options) }
|
||||
|
@ -8,5 +8,15 @@ module ApplicationHelper
|
||||
return number.to_s.gsub(/,/, '.').to_f
|
||||
end
|
||||
|
||||
# shortcut for capitalize
|
||||
def T(symbol)
|
||||
t(symbol).capitalize
|
||||
end
|
||||
|
||||
# shortcut for titleize
|
||||
def TT(symbol)
|
||||
t(symbol).titleize
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
@ -72,7 +72,7 @@ class Channel < ActiveRecord::Base
|
||||
|
||||
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 :not_social, lambda { where("social != true") }
|
||||
@ -101,19 +101,19 @@ class Channel < ActiveRecord::Base
|
||||
# select options
|
||||
def select_options(options = nil)
|
||||
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 += [:latitude] unless self.latitude.blank?
|
||||
only += [:longitude] unless self.longitude.blank?
|
||||
only += [:elevation] unless self.elevation.blank?
|
||||
only += [:field1] unless self.field1.blank?
|
||||
only += [:field2] unless self.field2.blank?
|
||||
only += [:field3] unless self.field3.blank?
|
||||
only += [:field4] unless self.field4.blank?
|
||||
only += [:field5] unless self.field5.blank?
|
||||
only += [:field6] unless self.field6.blank?
|
||||
only += [:field7] unless self.field7.blank?
|
||||
only += [:field8] unless self.field8.blank?
|
||||
only += [:latitude] if self.latitude.present?
|
||||
only += [:longitude] if self.longitude.present?
|
||||
only += [:elevation] if self.elevation.present?
|
||||
only += [:field1] if self.field1.present?
|
||||
only += [:field2] if self.field2.present?
|
||||
only += [:field3] if self.field3.present?
|
||||
only += [:field4] if self.field4.present?
|
||||
only += [:field5] if self.field5.present?
|
||||
only += [:field6] if self.field6.present?
|
||||
only += [:field7] if self.field7.present?
|
||||
only += [:field8] if self.field8.present?
|
||||
|
||||
# return a hash
|
||||
return { :only => only }
|
||||
@ -205,41 +205,35 @@ class Channel < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def private_windows *hidden
|
||||
if hidden.size >= 1
|
||||
return windows.where("private_flag = true and show_flag = #{hidden[0].to_s}")
|
||||
else
|
||||
return windows.where("private_flag = true" )
|
||||
end
|
||||
# private windows
|
||||
def private_windows(show_flag = false)
|
||||
show_flag = (show_flag.to_s == 'true') ? true : false
|
||||
return self.windows.where("private_flag = true AND show_flag = ?", show_flag)
|
||||
end
|
||||
|
||||
# overloaded version witthout private/public flag for the has_many dependent destroy action
|
||||
def public_windows hidden
|
||||
return windows.where("private_flag = false and show_flag = #{hidden}")
|
||||
end
|
||||
# measure of activity in terms of feeds per time period
|
||||
|
||||
def public?
|
||||
return public_flag
|
||||
# public windows
|
||||
def public_windows(show_flag = false)
|
||||
show_flag = (show_flag.to_s == 'true') ? true : false
|
||||
return self.windows.where("private_flag = false AND show_flag = ?", show_flag)
|
||||
end
|
||||
|
||||
# check if the channel is public
|
||||
def public?; self.public_flag; end
|
||||
|
||||
# check if the video has changed
|
||||
def video_changed?
|
||||
video_id_changed? || video_type_changed?
|
||||
end
|
||||
|
||||
# check if the location has changed
|
||||
def location_changed?
|
||||
latitude_changed? || longitude_changed?
|
||||
end
|
||||
|
||||
def feeds_changed?
|
||||
field1_changed? ||
|
||||
field2_changed? ||
|
||||
field3_changed? ||
|
||||
field4_changed? ||
|
||||
field5_changed? ||
|
||||
field6_changed? ||
|
||||
field7_changed? ||
|
||||
field8_changed?
|
||||
# check if the any of the fields have changed
|
||||
def fields_changed?
|
||||
field1_changed? || field2_changed? || field3_changed? || field4_changed? ||
|
||||
field5_changed? || field6_changed? || field7_changed? || field8_changed?
|
||||
end
|
||||
|
||||
def update_chart_portlets
|
||||
@ -472,10 +466,8 @@ class Channel < ActiveRecord::Base
|
||||
update_status_portlet true
|
||||
update_status_portlet false
|
||||
|
||||
#does channel have a window for every chart element
|
||||
if feeds_changed?
|
||||
update_chart_portlets
|
||||
end
|
||||
# does channel have a window for every chart element
|
||||
update_chart_portlets if fields_changed?
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -1,9 +1,9 @@
|
||||
<div class="FL">
|
||||
<h3><%= t(:api_key_write) %></h3>
|
||||
<%= @write_key %>
|
||||
<code class="large"><%= @write_key %></code>
|
||||
<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>
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= t(:api_key_key) %>:</td>
|
||||
<td><%= read_key %></td>
|
||||
<td><code class="large"><%= read_key %></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="VAT"><%= t(:note) %>:</td>
|
||||
@ -24,16 +24,16 @@
|
||||
<tr>
|
||||
<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 %>
|
||||
<%= 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>
|
||||
</table>
|
||||
<br><br>
|
||||
|
||||
<% 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>
|
||||
</div>
|
||||
<div id="sidebar_old">
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
<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 %>
|
||||
|
||||
<table class="table table-striped table-bordered tablesorter">
|
||||
@ -19,16 +21,19 @@
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
<a href="/channels/<%= channel.id %>">
|
||||
<i class="fa fa-<%= 'un' if channel.public_flag == true %>lock fa-fw"></i>
|
||||
<%= channel.name %>
|
||||
</a>
|
||||
<br>
|
||||
<%= link_to t(:private_link), channel_path(channel.id, :anchor => 'privateview') %> |
|
||||
<%= link_to t(:public_link), channel_path(channel.id, :anchor => 'publicview') %> |
|
||||
<%= link_to t(:settings_link), channel_path(channel.id, :anchor => 'channelsettings') %> |
|
||||
<%= link_to t(:api_key_link), channel_path(channel.id, :anchor => 'apikeys') %> |
|
||||
<%= link_to t(:data_import_link), channel_path(channel.id, :anchor => 'dataimport') %>
|
||||
<h4 style="margin-top: 0;">
|
||||
<a href="/channels/<%= channel.id %>">
|
||||
<i class="fa fa-<%= 'un' if channel.public_flag == true %>lock fa-fw"></i>
|
||||
<%= channel.name %>
|
||||
</a>
|
||||
</h4>
|
||||
<div class="btn-group btn-group-sm hidden-xs hidden-sm">
|
||||
<%= link_to t(:private_link), channel_path(channel.id, :anchor => 'privateview'), class: 'btn btn-default' %>
|
||||
<%= link_to t(:public_link), channel_path(channel.id, :anchor => 'publicview'), class: 'btn btn-default' %>
|
||||
<%= link_to t(:settings_link), channel_path(channel.id, :anchor => 'channelsettings'), class: 'btn btn-default' %>
|
||||
<%= 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><%= channel.created_at.strftime("%Y-%m-%d") %></td>
|
||||
@ -38,8 +43,6 @@
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<%= button_to t(:channel_create), channels_path, :method => :post, :class => 'btn btn-primary' %>
|
||||
|
||||
<% if current_admin_user.present? %>
|
||||
<br><br><br>
|
||||
<% @channels.each do |c| %>
|
||||
@ -72,9 +75,3 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).on('page:load ready', function() {
|
||||
$('.tablesorter').tablesorter();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -3,36 +3,43 @@
|
||||
|
||||
<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' %>
|
||||
|
||||
<%= link_to t(:edit).downcase, edit_plugin_path(p.id) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
</table>
|
||||
|
||||
<br><br>
|
||||
<% end %>
|
||||
|
||||
<%= form_for :plugin do |p| %>
|
||||
<input name='userlogin' class='userlogin' />
|
||||
<%= p.submit t(:plugin_create), :class => 'btn btn-primary' %>
|
||||
<% 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 id="sidebar" class="col-xs-12 col-sm-6">
|
||||
|
37
app/views/users/_list_channels.html.erb
Normal file
37
app/views/users/_list_channels.html.erb
Normal 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 %>
|
||||
|
@ -1,19 +1,2 @@
|
||||
<h3><%= t(:user_public_channels) %> <%= @user.login %></h3>
|
||||
|
||||
<% 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 %>
|
||||
<%= render 'list_channels' %>
|
||||
|
||||
|
@ -6,14 +6,15 @@
|
||||
</div>
|
||||
|
||||
<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') %>
|
||||
<br><br>
|
||||
<%= t(:profile_website) %>: <%= link_to @user.website, @user.website %>
|
||||
<br><br>
|
||||
<%= t(:profile_bio) %>: <%= @user.bio %>
|
||||
<br><br>
|
||||
<%= render 'list_channels' %>
|
||||
|
||||
<% else %>
|
||||
<%= t(:profile_not_public) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
<tr>
|
||||
<td><%= t(:api_key) %></td>
|
||||
<td>
|
||||
<%= @user.api_key %><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' %>
|
||||
<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-warning btn-sm' %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
Reference in New Issue
Block a user