Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added clickable/highlighted tables #57

Merged
merged 3 commits into from
Jul 12, 2013
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 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 hover();
}
}

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

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

tr th i {
color: #666;
}

@include hover();
}

.history-table {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary line break.

.description {
padding-right: 10px;
width: auto;
Expand All @@ -424,6 +426,8 @@ $client-form-nav-padding: 50px;
color: #999;
}
}

@include hover();
}

.documents-table {
Expand Down
5 changes: 4 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,7 @@ $nav-width-desktops: 200px;
$nav-width-widescreens: $nav-width-desktops;

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

// XXX: I dont know if this looks good or not
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this comment.

$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 hover() {
.ng-scope:hover {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this only applies to ng-scope, we should make the mixin name more descriptive.

cursor: pointer;
cursor: hand;
background-color: $table-hover;
}
}
5 changes: 3 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,15 @@
<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}'") %>
<%= defined?(rowModule) && raw("data-ng-click=" + rowModule) %> >
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a TODO explaining that we should investigate this weird behavior.

<% 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",
:rowModule => "editInField('#{field[:id]}',$index)",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rowModal, though I'd actually prefer rowClick

: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