Skip to content

Commit

Permalink
format search history and add reset selection btn
Browse files Browse the repository at this point in the history
  • Loading branch information
nanchenchen committed Sep 12, 2015
1 parent 482c336 commit 3a50c6e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 13 deletions.
11 changes: 9 additions & 2 deletions msgvis/static/SparQs/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,14 @@
if (Group.reset_search_group()){
Selection.changed('groups');
}
};
$scope.reset_selection = function(){

History.add_record("search:reset-selected-groups", {edit_mode: $scope.edit_mode, current_selection: Group.selected_groups});

if (Group.reset_selection()){
Selection.changed('groups');
}

};

Expand Down Expand Up @@ -406,7 +414,7 @@
};
$scope.show_messages = function($event, group, is_search){
$event.stopPropagation();
History.add_record("group:show-messages", {group: group});
History.add_record("group:show-messages", {group: group, is_search: is_search});

var current_params = params["edit_mode_" + $scope.edit_mode];
current_params.group_name = group.name;
Expand Down Expand Up @@ -474,7 +482,6 @@

};


$scope.finish_edit = function($event, group, reset_changes){
if ( $event ){
$event.stopPropagation();
Expand Down
13 changes: 9 additions & 4 deletions msgvis/static/SparQs/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -736,10 +736,15 @@
},
reset_selection: function(){
var self = this;
self.selected_groups.forEach(function(d){
d.selected = false;
});
self.selected_groups = [];
if ( self.selected_groups.length > 0 ){
self.selected_groups.forEach(function(d){
d.selected = false;
});
self.selected_groups = [];
return true;
}
return false;

},
toggle_current_search_group: function(){
var self = this;
Expand Down
34 changes: 33 additions & 1 deletion msgvis/static/grouper.less
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ body {
padding: 5px 10px;
cursor: pointer;
&:hover {
background-color: rgba(153, 198, 228, 0.24)
background-color: rgba(153, 198, 228, 0.24);

}
}
Expand Down Expand Up @@ -496,6 +496,29 @@ body {
font-weight: bold;
margin: 0 0 5px;
}

#history {
.record-box {
position: relative;
padding: 5px;
margin: 5px 0;
-webkit-box-shadow: 0 1px 1px 1px rgba(0,0,0,.1);
-moz-box-shadow: 0 1px 1px 1px rgba(0,0,0,.1);
box-shadow: 0 1px 1px 1px rgba(0,0,0,.1);
border: 0px solid #e3e3e3;
&:hover {
cursor: pointer;
background-color: rgba(153, 198, 228, 0.24);
}
}
.record {
font-size: 1.1em;
&.count {
color: #aaa;
}

}
}

#middle{
padding-left: 0;
Expand All @@ -507,11 +530,20 @@ body {
#viz-wrapper {
height: @bottom-row-height - @stat-box-height;
padding-left: 10px;
#viz {
position: relative;
.reset-selection-btn {
font-size: 8px;
padding: 4px 15px;
}
}

.heading {
font-weight: 600;
font-size: 1.5em;
}


sparqs-vis {
.c3-area {
opacity: 0;
Expand Down
22 changes: 16 additions & 6 deletions msgvis/templates/grouper.html
Original file line number Diff line number Diff line change
Expand Up @@ -324,16 +324,20 @@
</div>
<span us-spinner="spinnerOptions" spinner-key="search-spinner"></span>
</div>
<div ng-show="is_mode('search_history')">
<div id="history" ng-show="is_mode('search_history')">
<div class="heading" ng-show="!edit_mode">Search History </div>
<div ng-show="Group.search_records.length == 0" class="search-results-place-holder">
Search history will be shown here.
</div>
<div class="message-list heading-body">
<div class="box group-box"
ng-repeat="record in Group.search_records | orderBy:'created_at':true"
">
{$ record $}
<div class="record-box"
ng-repeat="record in Group.search_records | orderBy:'created_at':true"
ng-click="show_messages($event, record, true)">
<div class="record created_at">{$ record.created_at | date : 'yyyy-MM-dd HH:mm:ss'$}</div>
<div class="record keywords"><strong>Keywords</strong> {$ record.keywords $}</div>
<div class="record include_types"><strong>Includes</strong> {$ record.include_types.join(", ") $}</div>
<div class="record count">{$ record.message_count $} tweets</div>


</div>
</div>
Expand All @@ -348,7 +352,13 @@
<div id="viz-wrapper" class="col-md-8">
<div class="col-md-9">
<div id="viz" class="row app-panel" ng-controller="SparQs.controllers.VisualizationController">
<div class="heading">Visualization {$ title() $}</div>
<div class="heading">Visualization {$ title() $}
<div ng-show="Group.selected_groups.length > 0"
class="btn btn-default reset-selection-btn"
ng-click="reset_selection()" >
Reset selection</div>
</div>

<div id="viz-content" class="heading-body">
<sparqs-vis vis-data-table="datatable"
on-clicked="onVisClicked"
Expand Down

0 comments on commit 3a50c6e

Please sign in to comment.