More fixes...

This commit is contained in:
Szymon Nowak 2015-08-27 21:23:47 +02:00
parent 6cc1377e4f
commit f7631d2cea
15 changed files with 69 additions and 27 deletions

View File

@ -4,26 +4,25 @@ export default Ember.TextField.extend({
type: 'file',
classNames: ['invisible'],
click: function (event) {
click(event) {
event.stopPropagation();
},
change: function (event) {
var input = event.target,
files = input.files,
file = files[0];
change(event) {
const input = event.target;
const files = input.files;
const file = files[0];
this.sendAction('action', { file: file });
this.reset()
},
// Hackish way to reset file input when sender cancels file transfer,
// so if sender wants later to send the same file again,
// the 'change' event is triggered correctly.
fileDidChange: function () {
if (!this.get('file')) {
var field = this.$();
field.wrap('<form>').closest('form').get(0).reset();
field.unwrap();
}
}.observes('file')
reset() {
const field = this.$();
field.wrap('<form>').closest('form').get(0).reset();
field.unwrap();
}
});

View File

@ -0,0 +1,28 @@
import Ember from "ember";
export default Ember.Component.extend({
content: null,
selectedValue: null,
didInitAttrs() {
this._super(...arguments);
var content = this.get("content");
if (!content) {
this.set("content", []);
}
},
actions: {
change() {
const changeAction = this.get("action");
const selectedEl = this.$("select")[0];
const selectedIndex = selectedEl.selectedIndex;
const content = this.get("content");
const selectedValue = content[selectedIndex];
this.set("selectedValue", selectedValue);
changeAction(selectedValue);
}
}
});

View File

@ -2,8 +2,11 @@ import Ember from 'ember';
export default Ember.Component.extend({
actions: {
close: function() {
close() {
console.log("nop");
return this.sendAction();
}
},
nop() {}
}
});

5
app/helpers/is-equal.js Normal file
View File

@ -0,0 +1,5 @@
import Ember from "ember";
export default Ember.Helper.helper(function([leftSide, rightSide]) {
return leftSide === rightSide;
});

View File

@ -24,7 +24,7 @@
{{content-for 'body'}}
<script src="//cdn.firebase.com/js/client/2.1.0/firebase.js"></script>
<script src="//cdn.firebase.com/js/client/2.2.9/firebase.js"></script>
<script src="//login.persona.org/include.js"></script>
<script src="assets/vendor.js"></script>
<script src="assets/share-drop.js"></script>

View File

@ -7,7 +7,7 @@
</p>
<p>
{{room-url value=controller.currentUrl readonly="readonly" style="display: block; margin: auto;"}}
{{room-url value=currentUrl readonly="readonly" style="display: block; margin: auto;"}}
</p>
<p>

View File

@ -1,7 +1,7 @@
ShareDrop lets you share files with others.
Other people will see you as
<b>
{{#if controller.hasCustomRoomName}}
{{#if hasCustomRoomName}}
{{you.labelWithPublicIp}}
{{else}}
{{you.label}}

View File

@ -7,21 +7,21 @@
<ul class="nav">
<li>
<a href="javascript:void(0)" class="icon-create-room" {{action 'redirect'}} title="Create a room. You'll leave the room you're currently in.">+</a>
<a href="javascript:void(0)" class="icon-create-room" {{action "redirect"}} title="Create a room. You'll leave the room you're currently in.">+</a>
</li>
<li>
<a href="javascript:void(0)" class="icon-help" {{action 'openModal' 'about_app'}} title="About">?</a>
<a href="javascript:void(0)" class="icon-help" {{action "openModal" "about_app"}} title="About">?</a>
</li>
{{#if you.email}}
<li class="email">
{{you.email}}
</li>
<li>
<a href="javascript:void(0)" class="sign" {{action 'signOut'}}>Sign out</a>
<a href="javascript:void(0)" class="sign" {{action "signOut"}}>Sign out</a>
</li>
{{else}}
<li>
<a href="javascript:void(0)" class="sign" {{action 'signIn'}} title="Signing in will allow others to recognize you by your email address and Gravatar">Sign in</a>
<a href="javascript:void(0)" class="sign" {{action "signIn"}} title="Signing in will allow others to recognize you by your email address and Gravatar">Sign in</a>
</li>
{{/if}}
</ul>

View File

@ -0,0 +1,7 @@
<select {{action 'change' on='change'}}>
{{#each content key="@index" as |item|}}
<option value="{{item}}" selected={{is-equal item selectedValue}}>
{{item}}
</option>
{{/each}}
</select>

View File

@ -1,5 +1,5 @@
<div class="modal-overlay" {{action "close"}}>
<div class="modal-body" {{action bubbles=false preventDefault=false}}>
<div class="modal-body" {{action "nop" bubbles=false preventDefault=true}}>
{{yield}}
</div>
</div>

View File

@ -38,4 +38,4 @@
</div>
</div>
{{file-field action="uploadFile" file=transfer.file}}
{{file-field action="uploadFile"}}

View File

@ -1,6 +1,6 @@
<div class="popover-body">
<div class="popover-icon">
<i {{bind-attr class="iconClass"}}></i>
<i class="{{iconClass}}"></i>
</div>
<p>{{yield}}</p>

View File

@ -10,7 +10,7 @@
{{#if user.local_ip}}
{{#if user.hasManyLocalIps}}
{{view Ember.Select content=localIps value=user.local_ip}}
{{ip-select content=localIps action=(action (mut user.local_ip))}}
{{else}}
{{user.local_ip}}
{{/if}}

View File

@ -1,6 +1,6 @@
<main class="l-content">
<div class="user others">
{{#each peer in model}}
{{#each model as |peer|}}
{{peer-widget peer=peer hasCustomRoomName=hasCustomRoomName webrtc=webrtc}}
{{/each}}
</div>

View File

@ -1,7 +1,7 @@
{
"name": "share-drop",
"dependencies": {
"ember": "1.13.8",
"ember": "1.13.9",
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
"ember-load-initializers": "ember-cli/ember-load-initializers#0.1.5",