fuck yeah, flash messages
This commit is contained in:
parent
9237770180
commit
847c120bd7
|
@ -43,7 +43,7 @@ GIT
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/travis-ci/travis-api.git
|
remote: git://github.com/travis-ci/travis-api.git
|
||||||
revision: 5d9c867142162b20d8471530f7447bd4af93c0e4
|
revision: 18bffa246014e0ae380734277eb180021f1eb2b4
|
||||||
specs:
|
specs:
|
||||||
travis-api (0.0.1)
|
travis-api (0.0.1)
|
||||||
backports (~> 2.5)
|
backports (~> 2.5)
|
||||||
|
@ -61,7 +61,7 @@ GIT
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/travis-ci/travis-core.git
|
remote: git://github.com/travis-ci/travis-core.git
|
||||||
revision: adaa3d48f48a2a002827a2f15078323e53be1d10
|
revision: 45cb3ef8222af247c862e4b8a31c7033927d7048
|
||||||
branch: sf-travis-api
|
branch: sf-travis-api
|
||||||
specs:
|
specs:
|
||||||
travis-core (0.0.1)
|
travis-core (0.0.1)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'travis/log'
|
require 'travis/log'
|
||||||
require 'emoij'
|
require 'config/emoij'
|
||||||
|
|
||||||
@Travis.Helpers =
|
@Travis.Helpers =
|
||||||
compact: (object) ->
|
compact: (object) ->
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
|
{{#each flash in controller}}
|
||||||
|
{{#view Travis.FlashItemView flashBinding="flash"}}
|
||||||
<p>{{view.message}}</p>
|
<p>{{view.message}}</p>
|
||||||
<a class="close" {{action close target="view"}}></a>
|
<a class="close" {{action close target="view"}}></a>
|
||||||
|
{{/view}}
|
||||||
|
{{/each}}
|
||||||
|
|
|
@ -1,11 +1,25 @@
|
||||||
@Travis.reopen
|
@Travis.reopen
|
||||||
FlashView: Travis.View.extend
|
FlashView: Travis.View.extend
|
||||||
elementId: 'flash'
|
elementId: 'flash'
|
||||||
|
tagName: 'ul'
|
||||||
templateName: 'layouts/flash'
|
templateName: 'layouts/flash'
|
||||||
|
countBinding: 'controller.length'
|
||||||
|
|
||||||
flashBinding: 'controller.firstObject'
|
display: (->
|
||||||
classNameBindings: ['flash.type']
|
@set('classNames', if @get('count') == 0 then [] else ['display'])
|
||||||
messageBinding: 'flash.message'
|
).observes('count')
|
||||||
|
|
||||||
|
FlashItemView: Travis.View.extend
|
||||||
|
tagName: 'li'
|
||||||
|
classNameBindings: ['type']
|
||||||
|
|
||||||
|
type: (->
|
||||||
|
@get('flash') && Ember.keys(@get('flash'))[0]
|
||||||
|
).property('flash')
|
||||||
|
|
||||||
|
message: (->
|
||||||
|
@get('flash') && @get('flash')[@get('type')]
|
||||||
|
).property('flash')
|
||||||
|
|
||||||
close: (event) ->
|
close: (event) ->
|
||||||
@get('controller').shiftObject()
|
@get('controller').removeObject(@get('flash'))
|
||||||
|
|
|
@ -28,12 +28,9 @@ jQuery.support.cors = true
|
||||||
if options.data && method != 'GET' && method != 'get'
|
if options.data && method != 'GET' && method != 'get'
|
||||||
options.data = JSON.stringify(options.data)
|
options.data = JSON.stringify(options.data)
|
||||||
|
|
||||||
if options.success
|
success = options.success || (->)
|
||||||
success = options.success
|
|
||||||
options.success = (data) =>
|
options.success = (data) =>
|
||||||
if Travis.app?.router && data.flash
|
Travis.app.router.flashController.pushObjects(data.flash) if Travis.app?.router && data.flash
|
||||||
console.log(data.flash)
|
|
||||||
Travis.app.router.flashController.pushObject(data.flash)
|
|
||||||
delete data.flash
|
delete data.flash
|
||||||
success.call(this, data)
|
success.call(this, data)
|
||||||
|
|
||||||
|
|
|
@ -49,12 +49,13 @@ require 'ext/ember/namespace'
|
||||||
|
|
||||||
$ =>
|
$ =>
|
||||||
app.initialize()
|
app.initialize()
|
||||||
|
app.router.flashController.pushObject({ error: 'error!' })
|
||||||
|
|
||||||
loadConfig: (callback) ->
|
loadConfig: (callback) ->
|
||||||
@ajax.get '/config', (data) =>
|
@ajax.get '/config', (data) =>
|
||||||
$.extend @config, data.config
|
$.extend @config, data.config
|
||||||
console.log "Connecting to #{data.config.api_endpoint}"
|
|
||||||
callback(data.config)
|
callback(data.config)
|
||||||
|
|
||||||
require 'travis/ajax'
|
require 'travis/ajax'
|
||||||
require 'app'
|
require 'app'
|
||||||
|
|
||||||
|
|
|
@ -3,22 +3,22 @@
|
||||||
#flash
|
#flash
|
||||||
display: none
|
display: none
|
||||||
margin: -20px -40px 20px -30px
|
margin: -20px -40px 20px -30px
|
||||||
padding: 15px 40px 15px 30px
|
|
||||||
color: gray
|
color: gray
|
||||||
font-weight: bold
|
font-weight: bold
|
||||||
border-bottom: 1px solid $color-border-light
|
border-bottom: 1px solid $color-border-light
|
||||||
@include box-shadow(transparent 0 0 0 0, $color-border-normal 0 1px 6px 0, transparent 0 0 0 0, transparent 0 0 0 0)
|
@include box-shadow(transparent 0 0 0 0, $color-border-normal 0 1px 6px 0, transparent 0 0 0 0, transparent 0 0 0 0)
|
||||||
|
|
||||||
&.success, &.notice, &.error
|
li
|
||||||
display: block
|
position: relative
|
||||||
|
padding: 15px 40px 15px 30px
|
||||||
|
|
||||||
&.success
|
.success
|
||||||
background-color: #ebfcc2
|
background-color: #ebfcc2
|
||||||
|
|
||||||
&.notice
|
.notice
|
||||||
background-color: lightGoldenrodYellow
|
background-color: lightGoldenrodYellow
|
||||||
|
|
||||||
&.error
|
.error
|
||||||
background-color: #f5d7d3
|
background-color: #f5d7d3
|
||||||
|
|
||||||
p
|
p
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -958,7 +958,6 @@ li {
|
||||||
#flash {
|
#flash {
|
||||||
display: none;
|
display: none;
|
||||||
margin: -20px -40px 20px -30px;
|
margin: -20px -40px 20px -30px;
|
||||||
padding: 15px 40px 15px 30px;
|
|
||||||
color: gray;
|
color: gray;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
border-bottom: 1px solid #dddddd;
|
border-bottom: 1px solid #dddddd;
|
||||||
|
@ -966,9 +965,10 @@ li {
|
||||||
-moz-box-shadow: transparent 0 0 0 0, #cccccc 0 1px 6px 0, transparent 0 0 0 0, transparent 0 0 0 0;
|
-moz-box-shadow: transparent 0 0 0 0, #cccccc 0 1px 6px 0, transparent 0 0 0 0, transparent 0 0 0 0;
|
||||||
box-shadow: transparent 0 0 0 0, #cccccc 0 1px 6px 0, transparent 0 0 0 0, transparent 0 0 0 0;
|
box-shadow: transparent 0 0 0 0, #cccccc 0 1px 6px 0, transparent 0 0 0 0, transparent 0 0 0 0;
|
||||||
}
|
}
|
||||||
/* line 12, /Users/sven/Development/projects/travis/travis-web/assets/styles/app/flash.sass */
|
/* line 11, /Users/sven/Development/projects/travis/travis-web/assets/styles/app/flash.sass */
|
||||||
#flash.success, #flash.notice, #flash.error {
|
#flash li {
|
||||||
display: block;
|
position: relative;
|
||||||
|
padding: 15px 40px 15px 30px;
|
||||||
}
|
}
|
||||||
/* line 15, /Users/sven/Development/projects/travis/travis-web/assets/styles/app/flash.sass */
|
/* line 15, /Users/sven/Development/projects/travis/travis-web/assets/styles/app/flash.sass */
|
||||||
#flash .success {
|
#flash .success {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
3c986040
|
5643087a
|
Loading…
Reference in New Issue
Block a user