1
0
mirror of https://github.com/flarum/core.git synced 2025-08-02 22:47:33 +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 // When the dropdown menu is shown, select the contents of the permalink
// input so that the user can quickly copy the URL. // input so that the user can quickly copy the URL.
var component = this; var component = this;
this.$('a').click(function() { this.$('.dropdown-toggle').click(function() {
setTimeout(function() { component.$('.permalink').select(); }, 1); setTimeout(function() { component.$('.permalink').select(); }, 1);
}); });
@@ -32,5 +32,7 @@ export default Ember.Component.extend({
this.$('.permalink').click(function(e) { this.$('.permalink').click(function(e) {
e.stopPropagation(); e.stopPropagation();
}); });
this.set('touch', 'ontouchstart' in document.documentElement);
} }
}); });

View File

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

View File

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