1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 21:20:24 +02:00

Show permalink as a link on touch devices

This commit is contained in:
Toby Zerner
2015-03-04 12:27:43 +10:30
parent c3854074a7
commit bab695595d
3 changed files with 11 additions and 14 deletions

View File

@@ -24,7 +24,7 @@ export default Ember.Component.extend({
// When the dropdown menu is shown, select the contents of the permalink
// input so that the user can quickly copy the URL.
var component = this;
this.$('a').click(function() {
this.$('.dropdown-toggle').click(function() {
setTimeout(function() { component.$('.permalink').select(); }, 1);
});
@@ -32,5 +32,7 @@ export default Ember.Component.extend({
this.$('.permalink').click(function(e) {
e.stopPropagation();
});
this.set('touch', 'ontouchstart' in document.documentElement);
}
});

View File

@@ -200,7 +200,9 @@
margin-top: 10px;
}
& a.permalink {
display: none;
display: block;
overflow: hidden;
text-overflow: ellipsis;
}
}
@@ -279,16 +281,6 @@
margin-left: -30px;
margin-top: 2px;
}
.post-meta {
& a.permalink {
display: block;
overflow: hidden;
text-overflow: ellipsis;
}
& input.permalink {
display: none;
}
}
}
@media @tablet, @desktop, @desktop-hd {

View File

@@ -2,6 +2,9 @@
<div class="dropdown-menu post-meta">
<span class="number">Post #{{post.number}}</span>
<span class="time">{{full-time post.time}}</span>
<input value="{{permalink}}" class="form-control permalink">
<a href="{{permalink}}" class="btn btn-default permalink">{{permalink}}</a>
{{#if touch}}
<a href="{{permalink}}" class="btn btn-default permalink">{{permalink}}</a>
{{else}}
<input value="{{permalink}}" class="form-control permalink">
{{/if}}
</div>