Skip to content

Commit f243923

Browse files
kolaentelunny
andauthored
Fix PR/Issue titles on mobile (#13292)
* Start fixing Issue & PR title on mobile Signed-off-by: kolaente <[email protected]> * Make sure the save & cancel buttons float right Signed-off-by: kolaente <[email protected]> * Fix edit buttons and title input on mobile Co-authored-by: Lunny Xiao <[email protected]>
1 parent 4099e4f commit f243923

File tree

3 files changed

+85
-32
lines changed

3 files changed

+85
-32
lines changed

templates/repo/issue/view_title.tmpl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
<div class="sixteen wide column title">
2-
<div class="ui grid">
3-
<h1 class="twelve wide column">
2+
<div class="issue-title" id="issue-title-wrapper">
3+
{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .Repository.IsArchived)}}
4+
<div class="edit-button">
5+
<div id="edit-title" class="ui basic green not-in-edit button">{{.i18n.Tr "repo.issues.edit"}}</div>
6+
</div>
7+
{{end}}
8+
<h1>
49
<span class="index">#{{.Issue.Index}}</span> <span id="issue-title">{{RenderEmoji .Issue.Title}}</span>
510
<div id="edit-title-input" class="ui input" style="display: none">
611
<input value="{{.Issue.Title}}" maxlength="255">
712
</div>
813
</h1>
914
{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .Repository.IsArchived)}}
10-
<div class="four wide column">
11-
<div class="edit-zone text right">
12-
<div id="edit-title" class="ui basic green not-in-edit button">{{.i18n.Tr "repo.issues.edit"}}</div>
13-
<div id="cancel-edit-title" class="ui basic blue in-edit button" style="display: none">{{.i18n.Tr "repo.issues.cancel"}}</div>
14-
<div id="save-edit-title" class="ui green in-edit button" style="display: none" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/title" {{if .Issue.IsPull}}data-target-update-url="{{$.RepoLink}}/pull/{{.Issue.Index}}/target_branch"{{end}}>{{.i18n.Tr "repo.issues.save"}}</div>
15-
</div>
16-
</div>
15+
<div class="edit-buttons">
16+
<div id="cancel-edit-title" class="ui basic blue in-edit button" style="display: none">{{.i18n.Tr "repo.issues.cancel"}}</div>
17+
<div id="save-edit-title" class="ui green in-edit button" style="display: none" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/title" {{if .Issue.IsPull}}data-target-update-url="{{$.RepoLink}}/pull/{{.Issue.Index}}/target_branch"{{end}}>{{.i18n.Tr "repo.issues.save"}}</div>
18+
</div>
1719
{{end}}
1820
</div>
1921
{{if .HasMerged}}

web_src/js/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,7 @@ async function initRepository() {
792792
$('#pull-desc').toggle();
793793
$('#pull-desc-edit').toggle();
794794
$('.in-edit').toggle();
795+
$('#issue-title-wrapper').toggleClass('edit-active');
795796
$editInput.focus();
796797
return false;
797798
};

web_src/less/_repository.less

Lines changed: 73 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -632,36 +632,86 @@
632632
.title {
633633
padding-bottom: 0 !important;
634634

635-
h1 {
636-
font-weight: 300;
637-
font-size: 2.3rem;
638-
margin-bottom: 5px;
635+
.issue-title {
636+
margin-bottom: .5rem;
639637

640-
.ui.input {
641-
font-size: .5em;
642-
vertical-align: top;
643-
width: 50%;
644-
min-width: 600px;
638+
&.edit-active {
639+
display: flex;
640+
align-items: center;
645641

646-
input {
647-
font-size: 1.5em;
648-
padding: 6px 10px;
642+
h1 {
643+
display: flex;
644+
width: 100%;
645+
}
646+
647+
@media only screen and (max-width: 768px) {
648+
flex-direction: column;
649+
650+
h1 {
651+
margin-right: 0;
652+
margin-bottom: 1rem;
653+
padding-right: 0;
654+
655+
.ui.input input {
656+
width: calc(100% - 2rem);
657+
}
658+
}
659+
660+
.edit-buttons {
661+
padding-bottom: 1rem;
662+
width: 100%;
663+
664+
.button {
665+
width: 100%;
666+
margin-right: .5rem;
667+
668+
&:last-child {
669+
margin-right: 0;
670+
}
671+
}
672+
}
649673
}
650674
}
651-
}
652675

653-
.index {
654-
font-weight: 300;
655-
color: #aaaaaa;
656-
letter-spacing: -1px;
657-
}
676+
h1 {
677+
font-weight: 300;
678+
font-size: 2.3rem;
679+
margin: 0;
680+
padding-right: .5rem;
658681

659-
.label {
660-
margin-right: 10px;
661-
}
682+
.ui.input {
683+
font-size: .5em;
684+
width: 100%;
662685

663-
.edit-zone {
664-
margin-top: 10px;
686+
input {
687+
font-size: 1.5em;
688+
padding: 6px 1rem;
689+
}
690+
}
691+
}
692+
693+
.edit-button {
694+
float: right;
695+
padding-left: 1rem;
696+
}
697+
698+
.edit-buttons {
699+
display: flex;
700+
}
701+
702+
.index {
703+
font-weight: 300;
704+
color: #aaaaaa;
705+
letter-spacing: -1px;
706+
}
707+
708+
.label {
709+
margin-right: 10px;
710+
}
711+
712+
.edit-zone {
713+
margin-top: 10px;
714+
}
665715
}
666716
}
667717

0 commit comments

Comments
 (0)