Skip to content

Commit

Permalink
Merge pull request #364 from Spokenvote/spokenvote-363
Browse files Browse the repository at this point in the history
- Completes most of issue #363.

- Formatting and testing remaining.
  • Loading branch information
kimardenmiller committed Mar 29, 2015
2 parents 0545647 + 13a4bbe commit bf20b93
Show file tree
Hide file tree
Showing 129 changed files with 7,390 additions and 6,641 deletions.
56 changes: 45 additions & 11 deletions app/assets/javascripts/angular/controllers/hub_controller.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HubController = ['$scope', '$rootScope', '$location', '$http', 'SelectHubLoader', 'Hub', ($scope, $rootScope, $location, $http, SelectHubLoader, Hub) ->
HubController = ['$scope', '$rootScope', '$location', '$http', 'SelectHubLoader', 'Hub', 'Focus', ($scope, $rootScope, $location, $http, SelectHubLoader, Hub, Focus) ->

$scope.disabled = undefined

Expand All @@ -17,6 +17,11 @@ HubController = ['$scope', '$rootScope', '$location', '$http', 'SelectHubLoader'
$scope.sessionSettings.actions.hubFilter = 'All Groups'
$scope.sessionSettings.actions.hubShow = true

# $scope.$on 'focusHubFilter', ->
# console.log 'focusHubFilter Triggered '
#
# $scope.setInputFocus = ->
# $rootScope.$broadcast 'focusHubFilter'

$scope.refreshHubs = (hub_filter) ->
if hub_filter.length > 1
Expand All @@ -38,22 +43,51 @@ HubController = ['$scope', '$rootScope', '$location', '$http', 'SelectHubLoader'


$rootScope.setHub = (item, model) ->
$rootScope.eventResult = {item: item, model: model} # What does this line do?
item.id = item.select_id
$rootScope.sessionSettings.hub_attributes = item
$scope.sessionSettings.actions.hubShow = true
# $scope.sessionSettings.actions.selectHub = false
$location.search('hub', item.id)
$location.path('/proposals') unless $location.path() == '/start'
# $location.path('/proposals').search('hub', item.id) unless $location.path() == '/start'
$scope.sessionSettings.actions.hubFilter = $scope.sessionSettings.hub_attributes.short_hub # Need this?
# $scope.sessionSettings.actions.changeHub = false
if item.isTag
# $scope.sessionSettings.actions.hubShow = false
# $scope.sessionSettings.actions.hubCreate = true
# console.log 'item.isTag: ', item
$scope.sessionSettings.actions.searchTerm = item.full_hub
currentHub = $scope.sessionSettings.hub_attributes
$scope.sessionSettings.hub_attributes = {}
$scope.sessionSettings.hub_attributes.location_id = currentHub.location_id
$scope.sessionSettings.hub_attributes.formatted_location = currentHub.formatted_location
if !$scope.currentUser.id?
$scope.authService.signinFb($scope).then ->
$scope.votingService.new() unless $location.path() == '/start'
# $scope.sessionSettings.actions.changeHub = 'new'
$scope.sessionSettings.actions.hubCreate = true
Focus '#hub_formatted_location'
else
$scope.votingService.new() unless $location.path() == '/start'
# $scope.sessionSettings.actions.changeHub = 'new'
$scope.sessionSettings.actions.hubCreate = true
# console.log '$scope.sessionSettings.actions.changeHub: ', $scope.sessionSettings.actions.changeHub
Focus '#hub_formatted_location'
else
$rootScope.eventResult = {item: item, model: model} # What does this line do?
item.id = item.select_id
$rootScope.sessionSettings.hub_attributes = item
$scope.sessionSettings.actions.hubShow = true
$location.search('hub', item.id)
$location.path('/proposals') unless $location.path() == '/start'
# $location.path('/proposals').search('hub', item.id) unless $location.path() == '/start'
$scope.sessionSettings.actions.hubFilter = $scope.sessionSettings.hub_attributes.short_hub # Need this?
# $scope.sessionSettings.actions.changeHub = false
$scope.sessionSettings.actions.hubCreate = true
# $scope.sessionSettings.actions.selectHub = true


$scope.createSearchChoice = (newHub) ->
console.log 'newHub in HubController: ', newHub
{full_hub: newHub}

$scope.tagTransform = (newTag) ->
item =
full_hub: newTag

item

# $scope.clearFilter = (filter) ->
# $location.search(filter, null)
# $rootScope.sessionSettings.routeParams.user = null
Expand Down
19 changes: 11 additions & 8 deletions app/assets/javascripts/angular/controllers/start_controller.coffee
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#StartController = [ '$scope', '$location', 'Focus', '$timeout', '$route', 'proposal', ( $scope, $location, Focus, $timeout, $route, proposal ) ->
StartController = [ '$scope', '$location', 'Focus', '$timeout', '$route', ( $scope, $location, Focus, $timeout, $route ) ->
StartController = [ '$rootScope', '$scope', '$location', 'Focus', '$timeout', '$route', ( $rootScope, $scope, $location, Focus, $timeout, $route ) ->
# console.log 'StartController restarting'
# $scope.proposal = proposal
$scope.alertService.clearAlerts()

$scope.$on 'focusHubFilter', ->
console.log 'focusHubFilter Triggered '

# $scope.sessionSettings.actions.hubShow = false unless $route.current.params.hub or $scope.sessionSettings.actions.newProposal.started
$scope.sessionSettings.actions.hubShow = false unless $scope.sessionSettings.routeParams.hub or $scope.sessionSettings.actions.newProposal.started
$scope.sessionSettings.actions.newProposal.started = true
Expand Down Expand Up @@ -42,13 +39,18 @@ StartController = [ '$scope', '$location', 'Focus', '$timeout', '$route', ( $sco
# element.focus()
Focus '#vote_comment'

$scope.setInputFocus = ->
$scope.$broadcast 'focusHubFilter'

$rootScope.$on 'focusHubFilter', ->
console.log '$rootScope: focusHubFilter Triggered '

# $scope.setInputFocus = ->
# $rootScope.$broadcast 'focusHubFilter'


$scope.hubStep = ->
$scope.sessionSettings.actions.newProposal.comment = 'complete'
$scope.sessionSettings.actions.focus = 'hub'
$scope.sessionSettings.actions.hubShow = true
# $scope.sessionSettings.actions.newProposal.hub = 'active' unless $scope.sessionSettings.hub_attributes.id
if $scope.newProposalForm.$valid and $scope.sessionSettings.hub_attributes.id
$scope.sessionSettings.actions.focus = 'publish'
Expand All @@ -57,7 +59,7 @@ StartController = [ '$scope', '$location', 'Focus', '$timeout', '$route', ( $sco
$scope.alertService.setError 'The proposal is not quite right, too short perhaps?', $scope, 'main'

# console.log 'hubstep: '
$scope.$broadcast 'focusHubFilter'
$rootScope.$broadcast 'focusHubFilter'
# Focus '.ui-select-focusser'


Expand All @@ -83,9 +85,10 @@ StartController = [ '$scope', '$location', 'Focus', '$timeout', '$route', ( $sco
# uiSelectCtl.activate(false, true)

$scope.finishProp = ->
console.log 'finishProp: '
$scope.sessionSettings.actions.newProposal.hub = 'complete'
$scope.sessionSettings.actions.focus = 'publish'
Focus '#publish'
$timeout (-> Focus '#publish'), 500

# $scope.sessionSettings.actions.newProposal.hub = 'active' if $scope.sessionSettings.actions.newProposal.hub isnt 'complete'
# focusser.focus()
Expand Down
6 changes: 3 additions & 3 deletions app/assets/javascripts/angular/filters/formatting.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
App.filter "capitalize", ->
App.filter 'capitalize', ->
(input, scope) ->
input.substring(0, 1).toUpperCase() + input.replace(/_/, ' ').substring(1)
input.substring(0, 1).toUpperCase() + input.replace(/_/, ' ').substring(1) if input

App.filter "slice", ->
App.filter 'slice', ->
(arr, start, end) ->
arr.slice start, end
2 changes: 1 addition & 1 deletion app/assets/javascripts/angular/spokenvote.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ appConfig = ['$routeProvider', '$locationProvider', '$httpProvider', '$modalProv
window.App = angular.module('spokenvote', [
'ngRoute', 'ngAnimate',
'angular-loading-bar', 'templates',
'ui.select', 'ui.utils',
'ui.select',
# 'ui.select2', 'ui.select', 'ui.utils',
'ui.bootstrap.modal', 'ui.bootstrap.transition', 'ui.bootstrap.dropdownToggle', 'ui.bootstrap.tooltip', 'ui.bootstrap.buttons'
'spokenvote.services', 'spokenvote.directives',
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
//= require angular-sanitize/angular-sanitize

// require angular-ui-select2/src/select2
// require angular-ui-utils/ui-utils.min // Removed Mar 18, 2015 believing inflector was all we were using, so capitalize should work in place
//= require angular-ui-select/dist/select

// require angular-ui // below replaces this
//= require angular-ui-utils/ui-utils.min
//= require angular-ui-select/dist/select
//= require angular-ui-bootstrap/src/modal/modal
//= require angular-ui-bootstrap/src/transition/transition
//= require angular-ui-bootstrap/src/dropdownToggle/dropdownToggle
Expand Down
31 changes: 31 additions & 0 deletions app/assets/stylesheets/partials/_hub.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,35 @@
color: $happy-blue;
cursor: pointer;
}

.makeHub {
h3 {
color: $happy-blue;
// font-size: 135%;
margin: 0;
// padding: 5px;
}
.input-area {
// padding: 0 15px;
// width: 287px;
// min-width: 70%;
input {
text-align: center;
background-color: inherit;
font-size: 20px;
width: 100%;
margin-top: 5px;
&:focus {
outline: none;
}
}
.length_counter {
text-align: center;
.happy-text a.link {
color: $alert-blue;
}
}
}
}

}
57 changes: 31 additions & 26 deletions app/assets/stylesheets/partials/_proposal_create.scss
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
.newProposal { // Entire newProposal class probably obsolete
color: $tally-blue;
font-size: 1.7em;
.changehub {
.selecthub {
text-align: center;
padding: 2%;
}
}
.makeHub {
h3 {
color: $happy-blue;
font-size: 135%;
margin: 0;
padding: 5px;
}
.input-area {
padding: 0 15px;
width: 287px;
min-width: 70%;
input {
width: 100%;
margin-top: 5px;
}
.length_counter.happy-text a.link {
color: $alert-blue;
}
}
}
// .changehub {
// .selecthub {
// text-align: center;
// padding: 2%;
// }
// }
// .makeHub {
// h3 {
// color: $happy-blue;
//// font-size: 135%;
// margin: 0;
//// padding: 5px;
// }
// .input-area {
// padding: 0 15px;
// width: 287px;
// min-width: 70%;
// input {
// background-color: inherit;
// font-size: 20px;
// width: 100%;
// margin-top: 5px;
// &:focus {
// outline: none;
// }
// }
// .length_counter.happy-text a.link {
// color: $alert-blue;
// }
// }
// }
}

.dialog-footer {
Expand Down
24 changes: 16 additions & 8 deletions app/assets/stylesheets/partials/_select2.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
// Search box formatting

.select2-container {
.select2-choice {
width: 100%; // Mar 27, 2015 under ui-select, covers whole screen
.select2-choice {
height: 32px;
line-height: 32px;
border: none;
box-shadow: none;
outline: none;
background: $googlePanelGreyLettering;
color: inherit;
background: inherit;
// background: $googlePanelGreyLettering;
abbr {
right: 13px;
}
Expand Down Expand Up @@ -42,18 +45,23 @@

.select2-search {
input {
background: $chisel-grey;
background: inherit;
// background: $chisel-grey;
border: none;
border-radius: 2px;
}
}

.select2-drop-active {
background-color: $googlePanelGreyLettering;
background-color: $airbnbBackgroundWhite;
// background-color: $googlePanelGreyLettering;
border: none;
box-shadow: none;
.select2-results {
max-height: none;
}
}
.select2-no-results {
background: none !important;
color: #999 !important;
}
//.select2-no-results {
// background: none !important;
// color: #999 !important;
//}
2 changes: 1 addition & 1 deletion app/assets/stylesheets/partials/_ui-select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

}
.btn-default-focus {
outline: none;
color: inherit;
background-color: inherit;
outline: none;
box-shadow: none;
}
input {
Expand Down
4 changes: 2 additions & 2 deletions app/assets/templates/proposals/_show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
.main-proposal.row id='prop{{ proposal.id }}'
.col-xs-2
.improve_support_buttons
.votes.box ng-click='support(proposal)'
.votes.box ng-click='support(proposal)' tooltip-html-unsafe='{{tooltips.support}}' tooltip-placement='right'
i.fa.fa-sort-up
.big-percent
| {{ proposal.votes_percentage }}
span.pct %
.fork.box ng-click='improve(proposal)'
.fork.box ng-click='improve(proposal)' tooltip-html-unsafe='{{tooltips.improve}}' tooltip-placement='right'
i.fa.fa-lightbulb-o

.col-xs-10.proposal_statement
Expand Down
3 changes: 2 additions & 1 deletion app/assets/templates/proposals/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ section
a id='makeProposalLink' href='#' ng-click='newTopic()' Start a New Topic
.no-proposals.col-xs-12 ng-show='proposals.length == 0'
h3
span No {{ filterSelection | inflector:humanize }} topics found&nbsp
// Mar 18, 2015 Replaced inflector:humanize with capitalize to remove angular-ui-utils
span No {{ filterSelection | capitalize }} topics found&nbsp
span ng-if='sessionSettings.actions.hubFilter' for {{ sessionSettings.actions.hubFilter }}
span ng-if='sessionSettings.actions.userFilter' for {{ sessionSettings.actions.userFilter }}
30 changes: 0 additions & 30 deletions app/assets/templates/shared/_make_hub.html.haml

This file was deleted.

Loading

0 comments on commit bf20b93

Please sign in to comment.