Skip to content

Commit

Permalink
switch to angular 1.2
Browse files Browse the repository at this point in the history
misc polishment
  • Loading branch information
Pierre Tardy committed Nov 21, 2013
1 parent 6eccabc commit f77bdf6
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 18 deletions.
3 changes: 2 additions & 1 deletion www/codeparameter/src/views/directives/codefield.jade
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ basefield
label.control-label.col-sm-12(for="{{field.name}}")
| {{field.label}}
.col-sm-12
div(style="height:{{field.height}}px", ui-ace="field.aceconfig", ng-model="field.value")
div(style="height:{{field.height}}px", ui-ace="{mode:field.mode}", readonly="field.readonly",
ng-model="field.value")
2 changes: 1 addition & 1 deletion www/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def check_output(cmd):
# we take angular 1.2.0 which has important new features
# like ng-animate, and ng-if

ANGULAR_TAG = "v1.2.0-rc.3"
ANGULAR_TAG = "v1.2.1"
bower_json = {
"dependencies": {
"bootstrap": "~3.0.0",
Expand Down
7 changes: 5 additions & 2 deletions www/src/scripts/controllers/forcedialogController.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ angular.module('app').config [ "$stateProvider", ($stateProvider) ->
$state.go "^"
modal.modal.result.then(goUp, goUp)
]
forceDialogController = [ "$scope", "$state", "modal", "scheduler", "schedulers",
($scope, $state, modal, scheduler, schedulers) ->
forceDialogController = [ "$scope", "$state", "modal", "scheduler", "schedulers","$rootScope"
($scope, $state, modal, scheduler, schedulers, $rootScope) ->
# prepare default values
prepareFields = (fields) ->
for field in fields
Expand All @@ -41,6 +41,7 @@ angular.module('app').config [ "$stateProvider", ($stateProvider) ->
fields_ref = {}
gatherFields = (fields) ->
for field in fields
field.errors = ""
if field.type == "nested"
gatherFields(field.fields)
else
Expand All @@ -55,6 +56,8 @@ angular.module('app').config [ "$stateProvider", ($stateProvider) ->
if err.data.error.code == -32602
for k, v of err.data.error.message
fields_ref[k].errors = v
$rootScope.$apply()

cancel: ->
modal.modal.dismiss()
]
Expand Down
2 changes: 1 addition & 1 deletion www/src/scripts/routes.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ angular.module('app').provider 'topMenuStates', ->
states.push(state)
@$get = ->
states

@
angular.module('app').config [ "$stateProvider", "$urlRouterProvider", "topMenuStatesProvider"
($stateProvider, $urlRouterProvider, topMenuStatesProvider) ->

Expand Down
10 changes: 8 additions & 2 deletions www/src/scripts/services/alertService.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@ angular.module('app').factory 'alert', ['$rootScope', ($rootScope) ->
return alert
]
angular.module('app').config ['$httpProvider', ($httpProvider) ->
$httpProvider.responseInterceptors.push ["alert", "$q", (alert, $q) ->
$httpProvider.responseInterceptors.push ["alert", "$q", "$timeout", (alert, $q, $timeout) ->
return (promise) ->
promise.then (res)->
res
, (res, bla) ->
alert.error res.toString()
try
msg = "Error: #{res.status}:#{res.data.error} when:#{res.config.method} #{res.config.url}"
catch e
msg = res.toString()
$timeout ->
alert.error(msg)
, 100
$q.reject res
]

Expand Down
45 changes: 40 additions & 5 deletions www/src/styles/styles.less
Original file line number Diff line number Diff line change
@@ -1,20 +1,53 @@
@import "bootstrap/bootstrap.less";
@import "font-awesome/font-awesome.less";

// Scale up the modal
@media screen and (min-width: @screen-sm-min) {

.modal-dialog {
width: 90%;
}}
.ng-cloak {
display: none;
}

.animate-repeat.ng-enter,
.animate-repeat.ng-leave {
transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
transition: all 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750);
}
.animate-repeat.ng-enter{
transition: all 100ms cubic-bezier(0.250, 0.250, 0.750, 0.750);
}
.animate-repeat.ng-leave.ng-leave-active,
.animate-repeat.ng-enter {
opacity: 0;
margin-top:-70px;
transform: translateY(-70px);
-webkit-transform: translateY(-70px);
}
.animate-repeat.ng-enter.ng-enter-active,
.animate-repeat.ng-leave {
opacity: 1;
transform: translateY(0);
-webkit-transform: translateY(0px);
}

.reveal-animation.ng-enter,
.reveal-animation.ng-leave{
transition: all 500ms cubic-bezier(0.000, 0.915, 0.480, 0.995);
/* The animation preparation code */
}
.reveal-animation.ng-enter,
.reveal-animation.ng-leave.ng-leave-active {
/* The animation code itself */
opacity: 0;
transform: translateY(-150px) scale(.2);
-webkit-transform: translateY(-150px) scale(.2);
}
.reveal-animation.ng-leave,
.reveal-animation.ng-enter.ng-enter-active {
/* The animation code itself */
opacity: 1;
-webkit-transform: translateY(0px) scale(1);
}
.breadcrumb .btn {
height: 29px;
margin-top: -5px;
Expand All @@ -24,6 +57,8 @@
content: "";
padding: 0 2px;
}
.modal.fade.in {
display: block !important;

/* hack to make modal work with ng-animate */
.modal {
display: block !important;
}
9 changes: 7 additions & 2 deletions www/src/views/directives/basefield.jade
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
div
//- should switch to popover when this is fixed: https://github.com/angular-ui/bootstrap/issues/590
.alert.alert-danger.col-sm-10.col-sm-offset-2(ng-if="field.errors")
| {{field.errors}}
//-.alert.alert-danger.col-sm-10.col-sm-offset-2(ng-if="field.errors")
div.form-group(ng-class="{'has-warning': field.warnings,'has-error': field.errors}")
div(ng-transclude)
.popover.bottom.reveal-animation(ng-if="field.errors", style="display:block;top:40px")
h5.popover-title
| {{field.label}}:
.popover-content
p {{field.errors}}
.arrow
2 changes: 1 addition & 1 deletion www/src/views/directives/tabslayout.jade
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
div
tabset
tab(ng-repeat='field in field.fields | filter:{hide:false}',
heading="{{field.name}}",
heading="{{field.tablabel}}",
class="{{column_class}}")
forcefield(recursive,
field="field")
2 changes: 1 addition & 1 deletion www/src/views/directives/textfield.jade
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
basefield
label.control-label.col-sm-2(for="{{field.name}}")
| {{field.label}} {{field.value}}
| {{field.label}}
.col-sm-10
input.form-control(type='text', ng-model="field.value")
4 changes: 2 additions & 2 deletions www/src/views/directives/verticallayout.jade
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.panel.panel-default
.panel-heading(ng-if="field.paneltitle")
| {{field.paneltitle}}
.panel-heading(ng-if="field.label")
| {{field.label}}
.panel-body
div.form-horizontal
div(ng-repeat='field in field.fields | filter:{hide:false}',
Expand Down

0 comments on commit f77bdf6

Please sign in to comment.