Fossil SCM

The 'placeholder' attribute of the two /chat text input fields how includes the project name to help avoid confusion about which /chat one is typing into without requiring new screen real estate for a project-name label.

stephan 2021-04-07 10:09 trunk
Commit 69135e4f61bddb40529f5943254732e5b17425b79b5727f959c82b1095439979
1 file changed +5 -3
+5 -3
--- src/chat.c
+++ src/chat.c
@@ -145,26 +145,28 @@
145145
** Other /chat-OP pages are used by XHR requests from this page to
146146
** send new chat message, delete older messages, or poll for changes.
147147
*/
148148
void chat_webpage(void){
149149
char *zAlert;
150
+ char *zProjectName;
150151
login_check_credentials();
151152
if( !g.perm.Chat ){
152153
login_needed(g.anon.Chat);
153154
return;
154155
}
155156
zAlert = mprintf("%s/builtin/%s", g.zBaseURL,
156157
db_get("chat-alert-sound","alerts/plunk.wav"));
158
+ zProjectName = db_get("project-name","Unnamed project");
157159
style_set_current_feature("chat");
158160
style_header("Chat");
159161
@ <form accept-encoding="utf-8" id="chat-form" autocomplete="off">
160162
@ <div id='chat-input-area'>
161163
@ <div id='chat-input-line'>
162164
@ <input type="text" name="msg" id="chat-input-single" \
163
- @ placeholder="Type message here." autocomplete="off">
165
+ @ placeholder="Type message for %h(zProjectName)." autocomplete="off">
164166
@ <textarea rows="8" id="chat-input-multi" \
165
- @ placeholder="Type message here. Ctrl-Enter sends it." \
167
+ @ placeholder="Type message for %h(zProjectName). Ctrl-Enter sends it." \
166168
@ class="hidden"></textarea>
167169
@ <input type="submit" value="Send" id="chat-message-submit">
168170
@ <span id="chat-settings-button" class="settings-icon" \
169171
@ aria-label="Settings..." aria-haspopup="true" ></span>
170172
@ </div>
@@ -183,11 +185,11 @@
183185
@ </form>
184186
@ <div id='chat-messages-wrapper'>
185187
/* New chat messages get inserted immediately after this element */
186188
@ <span id='message-inject-point'></span>
187189
@ </div>
188
-
190
+ fossil_free(zProjectName);
189191
builtin_fossil_js_bundle_or("popupwidget", "storage", "fetch", NULL);
190192
/* Always in-line the javascript for the chat page */
191193
@ <script nonce="%h(style_nonce())">/* chat.c:%d(__LINE__) */
192194
/* We need an onload handler to ensure that window.fossil is
193195
initialized before the chat init code runs. */
194196
--- src/chat.c
+++ src/chat.c
@@ -145,26 +145,28 @@
145 ** Other /chat-OP pages are used by XHR requests from this page to
146 ** send new chat message, delete older messages, or poll for changes.
147 */
148 void chat_webpage(void){
149 char *zAlert;
 
150 login_check_credentials();
151 if( !g.perm.Chat ){
152 login_needed(g.anon.Chat);
153 return;
154 }
155 zAlert = mprintf("%s/builtin/%s", g.zBaseURL,
156 db_get("chat-alert-sound","alerts/plunk.wav"));
 
157 style_set_current_feature("chat");
158 style_header("Chat");
159 @ <form accept-encoding="utf-8" id="chat-form" autocomplete="off">
160 @ <div id='chat-input-area'>
161 @ <div id='chat-input-line'>
162 @ <input type="text" name="msg" id="chat-input-single" \
163 @ placeholder="Type message here." autocomplete="off">
164 @ <textarea rows="8" id="chat-input-multi" \
165 @ placeholder="Type message here. Ctrl-Enter sends it." \
166 @ class="hidden"></textarea>
167 @ <input type="submit" value="Send" id="chat-message-submit">
168 @ <span id="chat-settings-button" class="settings-icon" \
169 @ aria-label="Settings..." aria-haspopup="true" ></span>
170 @ </div>
@@ -183,11 +185,11 @@
183 @ </form>
184 @ <div id='chat-messages-wrapper'>
185 /* New chat messages get inserted immediately after this element */
186 @ <span id='message-inject-point'></span>
187 @ </div>
188
189 builtin_fossil_js_bundle_or("popupwidget", "storage", "fetch", NULL);
190 /* Always in-line the javascript for the chat page */
191 @ <script nonce="%h(style_nonce())">/* chat.c:%d(__LINE__) */
192 /* We need an onload handler to ensure that window.fossil is
193 initialized before the chat init code runs. */
194
--- src/chat.c
+++ src/chat.c
@@ -145,26 +145,28 @@
145 ** Other /chat-OP pages are used by XHR requests from this page to
146 ** send new chat message, delete older messages, or poll for changes.
147 */
148 void chat_webpage(void){
149 char *zAlert;
150 char *zProjectName;
151 login_check_credentials();
152 if( !g.perm.Chat ){
153 login_needed(g.anon.Chat);
154 return;
155 }
156 zAlert = mprintf("%s/builtin/%s", g.zBaseURL,
157 db_get("chat-alert-sound","alerts/plunk.wav"));
158 zProjectName = db_get("project-name","Unnamed project");
159 style_set_current_feature("chat");
160 style_header("Chat");
161 @ <form accept-encoding="utf-8" id="chat-form" autocomplete="off">
162 @ <div id='chat-input-area'>
163 @ <div id='chat-input-line'>
164 @ <input type="text" name="msg" id="chat-input-single" \
165 @ placeholder="Type message for %h(zProjectName)." autocomplete="off">
166 @ <textarea rows="8" id="chat-input-multi" \
167 @ placeholder="Type message for %h(zProjectName). Ctrl-Enter sends it." \
168 @ class="hidden"></textarea>
169 @ <input type="submit" value="Send" id="chat-message-submit">
170 @ <span id="chat-settings-button" class="settings-icon" \
171 @ aria-label="Settings..." aria-haspopup="true" ></span>
172 @ </div>
@@ -183,11 +185,11 @@
185 @ </form>
186 @ <div id='chat-messages-wrapper'>
187 /* New chat messages get inserted immediately after this element */
188 @ <span id='message-inject-point'></span>
189 @ </div>
190 fossil_free(zProjectName);
191 builtin_fossil_js_bundle_or("popupwidget", "storage", "fetch", NULL);
192 /* Always in-line the javascript for the chat page */
193 @ <script nonce="%h(style_nonce())">/* chat.c:%d(__LINE__) */
194 /* We need an onload handler to ensure that window.fossil is
195 initialized before the chat init code runs. */
196

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button