Skip to content

Commit

Permalink
Merge local branch 'button_styles'
Browse files Browse the repository at this point in the history
  • Loading branch information
yammmt committed Nov 10, 2024
2 parents 79c6e15 + 79a3766 commit 0aadcb7
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 41 deletions.
25 changes: 7 additions & 18 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,9 @@ fn detail_page() {
assert!(body.contains("Task name"));
assert!(body.contains("Description"));
assert!(body.contains("Last updated"));
assert!(body.contains(
r#"<button class="button is-primary is-light" type="submit">Update</button>"#
));
assert!(body.contains(
r#"<button class="button is-link is-light" onclick="location.href='../'">Back to index page</button>"#
));
// dirty sentence: a part of the HTML button string
assert!(body.contains(r#"type="submit">Update</button>"#));
assert!(body.contains(r#"onclick="location.href='../'"#));
})
}

Expand Down Expand Up @@ -203,14 +200,10 @@ fn confirm_page() {

// Ensure confirm page shows buttons
let body = res.into_string().await.unwrap();
assert!(body.contains(
r#"<button class="button is-danger is-light" type="submit">Delete</button>"#
));
assert!(body.contains(r#"type="submit">Delete</button>"#));
// If I write full button HTML, `cargo test` hangs up. I don't know why.
assert!(body.contains("Back to task</button>"));
assert!(body.contains(
r#"<button class="button is-link is-light" onclick="location.href='/'">Back to index page</button>"#
));
assert!(body.contains(r#"onclick="location.href='/'"#));
})
}

Expand All @@ -235,13 +228,9 @@ fn label_confirm_page() {

// Ensure confirm page shows buttons
let body = res.into_string().await.unwrap();
assert!(body.contains(
r#"<button class="button is-danger is-light" type="submit">Delete</button>"#
));
assert!(body.contains(r#"type="submit">Delete</button>"#));
assert!(body.contains("Back to label</button>"));
assert!(body.contains(
r#"<button class="button is-link is-light" onclick="location.href='/'">Back to index page</button>"#
));
assert!(body.contains(r#"onclick="location.href='/'"#));
})
}

Expand Down
2 changes: 1 addition & 1 deletion static/bulma
Submodule bulma updated 151 files
2 changes: 1 addition & 1 deletion static/css/mystyles.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions static/label/confirm.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
<div class="container">
<form class="inline" action="/label/{{ label.id }}" method="post">
<input type="hidden" name="_method" value="delete" />
<button class="button is-danger is-light" type="submit">Delete</button>
<button class="button button-delete is-light" type="submit">Delete</button>
</form>
</div>
</section>

<section class="section">
<div class="container">
<button class="button is-link is-light" onclick="location.href='./edit'">Back to label</button>
<button class="button is-link is-light" onclick="location.href='/'">Back to index page</button>
<button class="button button-back is-light" onclick="location.href='./edit'">Back to label</button>
<button class="button button-back is-light" onclick="location.href='/'">Back to index page</button>
</div>
</section>
{% endblock content %}
8 changes: 4 additions & 4 deletions static/label/edit.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@

<div class="field">
<div class="control">
<button class="button is-primary is-light" type="submit">Update</button>
<button class="button button-update is-light" type="submit">Update</button>
</div>
</div>
</form>
</div>

<div class="container">
<button class="button is-danger is-light" onclick="location.href='./confirm'">Delete this label</button>
<button class="button button-delete is-light" onclick="location.href='./confirm'">Delete this label</button>
</div>
</section>

<section class="section">
<div class="container">
<button class="button is-link is-light" onclick="location.href='../'">Back to label list page</button>
<button class="button is-link is-light" onclick="location.href='../../'">Back to index page</button>
<button class="button button-back is-light" onclick="location.href='../'">Back to label list page</button>
<button class="button button-back is-light" onclick="location.href='../../'">Back to index page</button>
</div>
</section>
{% endblock content %}
6 changes: 3 additions & 3 deletions static/label/index.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
name="name" id="name" value="" autofocus>
<input type="text" placeholder="new label color?"
name="color" id="color" value="#90ee90">
<button class="button is-small is-info is-light" type="submit">add</button>
<button class="button button-add-small is-light" type="submit">add</button>
</form>

<table class="table">
Expand All @@ -32,7 +32,7 @@
{% for label in labels %}
<tr>
<td>
<button class="button is-outlined label-button" style="background-color: {{ label.color_hex }}" onclick="location.href='/label/{{ label.id }}'">
<button class="button label-button" style="background-color: {{ label.color_hex }}" onclick="location.href='/label/{{ label.id }}'">
{{ label.name }}
</button>
</td>
Expand All @@ -51,7 +51,7 @@

<section class="section">
<div class="container">
<button class="button is-link is-light" onclick="location.href='../'">Back to index page</button>
<button class="button button-back is-light" onclick="location.href='../'">Back to index page</button>
</div>
</section>
{% endblock content %}
13 changes: 13 additions & 0 deletions static/mystyles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,17 @@ $section-padding: 1rem 1.5rem;
// to avoid buttons with inappropriately low contrast.
// Note that button's background color is decided by the user.
.button.label-button { color: black; }
.button.button-add-small {
@extend .is-small;
@extend .is-info;
}
.button.button-back {
@extend .is-link;
}
.button.button-delete {
@extend .is-danger;
}
.button.button-update {
@extend .is-primary;
}
.tag.label-tag { color: black; }
4 changes: 2 additions & 2 deletions static/task/bylabel.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<td>
<form class="inline" action="{{ task.id }}/date" method="post">
<input type="hidden" name="_method" value="post" />
<button class="button is-primary is-light" type="submit">I did it today!</button>
<button class="button button-update is-light" type="submit">I did it today!</button>
</form>
</td>
</tr>
Expand All @@ -41,7 +41,7 @@

<section class="section">
<div class="container">
<button class="button is-link is-light" onclick="location.href='../'">Back to index page</button>
<button class="button button-back is-light" onclick="location.href='../'">Back to index page</button>
</div>
</section>
{% endblock content %}
6 changes: 3 additions & 3 deletions static/task/confirm.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
<div class="container">
<form class="inline" action="/{{ task.id }}" method="post">
<input type="hidden" name="_method" value="delete" />
<button class="button is-danger is-light" type="submit">Delete</button>
<button class="button button-delete is-light" type="submit">Delete</button>
</form>
</div>
</section>

<section class="section">
<div class="container">
<button class="button is-link is-light" onclick="location.href='/{{ task.id }}'">Back to task</button>
<button class="button is-link is-light" onclick="location.href='/'">Back to index page</button>
<button class="button button-back is-light" onclick="location.href='/{{ task.id }}'">Back to task</button>
<button class="button button-back is-light" onclick="location.href='/'">Back to index page</button>
</div>
</section>
{% endblock content %}
6 changes: 3 additions & 3 deletions static/task/edit.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@

<div class="field">
<div class="control">
<button class="button is-primary is-light" type="submit">Update</button>
<button class="button button-update is-light" type="submit">Update</button>
</div>
</div>
</form>
</div>

<div class="container">
<button class="button is-danger is-light" onclick="location.href='{{ task.id }}/confirm'">Delete this task</button>
<button class="button button-delete is-light" onclick="location.href='{{ task.id }}/confirm'">Delete this task</button>
</div>
</section>

<section class="section">
<div class="container">
<button class="button is-link is-light" onclick="location.href='../'">Back to index page</button>
<button class="button button-back is-light" onclick="location.href='../'">Back to index page</button>
</div>
</section>
{% endblock content %}
6 changes: 3 additions & 3 deletions static/task/index.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<form class="inline" action="/" method="post">
<input type="text" placeholder="new task name?"
name="name" id="name" value="" autofocus>
<button class="button is-small is-info is-light" type="submit">add</button>
<button class="button button-add-small is-info is-light" type="submit">add</button>
</form>

<table class="table">
Expand All @@ -35,7 +35,7 @@
{% if task.label_id %}
{% for label in labels %}
{% if label.id == task.label_id %}
<button class="button is-outlined label-button" style="background-color: {{ label.color_hex }}" onclick="location.href='/label/{{ task.label_id }}'">
<button class="button label-button" style="background-color: {{ label.color_hex }}" onclick="location.href='/label/{{ task.label_id }}'">
{{ label.name }}
</button>
{% break %}
Expand All @@ -50,7 +50,7 @@
<td>
<form class="inline" action="{{ task.id }}/date" method="post">
<input type="hidden" name="_method" value="post" />
<button class="button is-primary is-light" type="submit">I did it today!</button>
<button class="button button-update is-light" type="submit">I did it today!</button>
</form>
</td>
</tr>
Expand Down

0 comments on commit 0aadcb7

Please sign in to comment.