Skip to content

Commit

Permalink
Merge pull request #57 from mhxu/master
Browse files Browse the repository at this point in the history
Added clickable/highlighted tables
  • Loading branch information
DouglasSherk committed Jul 12, 2013
2 parents ce7ea38 + 85b29e3 commit f57fa33
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 13 deletions.
15 changes: 9 additions & 6 deletions app/assets/stylesheets/angular/clients.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ $client-form-nav-padding: 50px;
}
}
}

.data-table {
background-color: $light-gray;
@include ng-scope-hover();
}
}

.section-edit {
Expand Down Expand Up @@ -388,15 +393,11 @@ $client-form-nav-padding: 50px;
text-align: center;
}

.ng-scope:hover {
cursor: pointer;
cursor: hand;
background-color: #f7f7f7;
}

tr th i {
color: #666;
}

@include ng-scope-hover();
}

.history-table {
Expand Down Expand Up @@ -424,6 +425,8 @@ $client-form-nav-padding: 50px;
color: #999;
}
}

@include ng-scope-hover();
}

.documents-table {
Expand Down
4 changes: 3 additions & 1 deletion app/assets/stylesheets/shared/_constants.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ $nav-width-desktops: 200px;
$nav-width-widescreens: $nav-width-desktops;

$light-gray: #f8f8f8;
$light-green: #ddffdd;
$light-green: #ddffdd;

$table-hover: rgba(200,200,200,0.1);
8 changes: 8 additions & 0 deletions app/assets/stylesheets/shared/_utilities.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,11 @@ $break-xlarge: 1200px;
-moz-border-radius: $radius;
border-radius: $radius;
}

@mixin ng-scope-hover() {
.ng-scope:hover {
cursor: pointer;
cursor: hand;
background-color: $table-hover;
}
}
6 changes: 4 additions & 2 deletions app/views/templates/clients/_action_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@
<td colspan="<%= fields.length + 1 %>">No <%= name %> available.</td>
</tr>
<tr data-ng-repeat="item in <%= model %><%= ".slice(0, #{limit})" if !local_assigns[:limit].nil? %><%= " | orderBy:#{model}Predicate:#{model}Reverse" if local_assigns[:sortable] %>"
<%= defined?(rowhref) && raw("data-click-href='#{rowhref}'") %> >
<%= defined?(rowHref) && raw("data-click-href='#{rowHref}'") %>
<% # TODO: Investigate weirld interaction between single quotes and double qoutes which occurs when it is all one string %>
<%= defined?(rowClick) && raw("data-ng-click=" + rowClick) %> >
<% fields.each do |field| %>
<td class="<%= field[:class] %>"><%= raw field[:content] %></td>
<% end %>
<td class="actions align-right">
<% actions.each do |action| %>
<a data-ng-href="<%= action[:href] %>" data-ng-click="<%= raw(action[:click]) %>"
class="pure-button pure-button-small <%= action[:class] %>" <%= raw action[:attrs] %> >
class="pure-button pure-button-small <%= action[:class] %>" <%= raw action[:attrs] %> eat-click>
<i class="<%= action[:icon] %> icon-large"></i>
</a>
<% end %>
Expand Down
1 change: 1 addition & 0 deletions app/views/templates/clients/_field_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:locals => {
:name => 'data',
:model => "client.#{field[:id]}.value",
:rowClick => "editInField('#{field[:id]}',$index)",
:fields => [
{
:name => field[:type].first[:name],
Expand Down
2 changes: 1 addition & 1 deletion app/views/templates/clients/_recent_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
:name => 'clients',
:model => 'clients.clients',
:limit => local_assigns[:limit],
:rowhref => '#/clients/show/{{ item.id }}',
:rowHref => '#/clients/show/{{ item.id }}',
:fields => [
{
:name => 'Name',
Expand Down
2 changes: 1 addition & 1 deletion app/views/templates/clients/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
:name => 'clients',
:model => 'clients',
:infiniteScroll => 'updateResults(true)',
:rowhref => '#/clients/show/{{ item.id }}',
:rowHref => '#/clients/show/{{ item.id }}',
:sortable => {},
:fields => [
{
Expand Down
2 changes: 2 additions & 0 deletions app/views/templates/clients/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
:locals => {
:name => 'history',
:model => 'history',
:rowHref => '#/clients/edit/{{ item.client_id }}/{{ item.id }}',
:fields => [
{
:name => 'Description',
Expand Down Expand Up @@ -127,6 +128,7 @@
:locals => {
:name => 'documents',
:model => 'documents',
:rowHref => '/api/documents/{{ item.id }}',
:fields => [
{
:name => 'Description',
Expand Down
5 changes: 3 additions & 2 deletions app/views/templates/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@
:name => 'history',
:model => 'history',
:limit => 5,
:rowHref => '#/clients/edit/{{ item.client_id }}/{{ item.id }}',
:fields => [
{
:name => 'Description',
:class => 'description',
:content => <<-END
{{ item.description | ellipsize: 40:1 }}
<div class="detail">
on client <a data-ng-href="#/clients/show/{{ item.client_id }}" class="pretty">{{ item.client_name }} </a>
by <a data-ng-href="#/users/show/{{ item.user_id }}" class="email">{{ item.user_email }}</a><br />
on client <a data-ng-href="#/clients/show/{{ item.client_id }}" class="pretty" eat-click>{{ item.client_name }} </a>
by <a data-ng-href="#/users/show/{{ item.user_id }}" class="email" eat-click>{{ item.user_email }}</a><br />
on <span class="date">{{ item.updated_at | date: 'medium'}}</span>
</div>
END
Expand Down

0 comments on commit f57fa33

Please sign in to comment.