Skip to content

Commit

Permalink
FEATURE: Storing selected text when coding a memo (#106)
Browse files Browse the repository at this point in the history
If the user selects a portion of a field/interview/transcript memo and then creates a coding memo, the resulting memo includes the selected text as a quotation (formatted as a `blockquote`). If the user grounds an already existing code, the quotation is appended to the existing coding memo.
  • Loading branch information
christophe-lejeune committed Nov 2, 2020
1 parent 6ff4a80 commit 948d2af
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
14 changes: 14 additions & 0 deletions app/_attachments/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ body {
margin: 0;
}

blockquote {
color: gray;
margin-left: 1rem;
padding-left: 1rem;
border-left: 3px gray solid;
}

#leaves a,
#groundings a, #content a {
color: gray !important;
Expand Down Expand Up @@ -145,6 +152,13 @@ div.post {
width: 100%;
}

.mytooltip:hover .preview blockquote {
color: white;
padding-left: 1rem;
padding-left: 0rem;
border-left: 0px;
}

.card>p>.moment,
.comment>.meta,
#negative-case>.meta,
Expand Down
3 changes: 2 additions & 1 deletion app/lib/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ var shared = {
create(classlist[classlist.length - 1], $('#leave-name').val().trim());\
}\
});\
function create(type, name) {\
function create(type, name, highlight) {\
$('.spinner').removeClass('d-none');\
if (name.replace(/[ ,]/g, '') == '' && type != 'diagram') {\
$('.spinner').addClass('d-none');\
Expand Down Expand Up @@ -297,6 +297,7 @@ var shared = {
destination += 'editable_memo/';\
data.diary = '{{diary}}',\
data.body = '';\
if (type == 'coding' && highlight.length > 0) data.body += '> '+highlight+'\\n';\
data.type = type;\
}\
if (type) {\
Expand Down
2 changes: 1 addition & 1 deletion app/templates/diary.html
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ <h1>{{diary_name}}
momentRelative('#memos');
converter.setFlavor('github');
$('.preview').html(function(i, text) {
return converter.makeHtml(text.trim());
return converter.makeHtml(text.replace(/&gt;/g, '>').trim());
});
var nothing_to_show = '{{i18n.i_nothing-to-show}}';
{{^logged}}nothing_to_show +='. {{i18n.i_sign-in-for-more}}';{{/logged}}
Expand Down
12 changes: 7 additions & 5 deletions app/templates/memo.html
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ <h1><img src="{{>relpath}}style/{{type}}.svg"/> {{name}}</h1>
strikethrough: 'true'
});
$('.post').html(function(i, text) {
return converter.makeHtml(text.trim());
return converter.makeHtml(text.replace(/&gt;/g, '>').trim());
});
if ($('#groundings li').length == 1) $("#groundings").find('legend').text("{{i18n.i_grounding}}");
if ($('#groundings li').length < 1) $("#groundings").addClass('hidden');
Expand Down Expand Up @@ -537,31 +537,33 @@ <h1><img src="{{>relpath}}style/{{type}}.svg"/> {{name}}</h1>
$("#field-leaf").prop("checked", true).trigger("click");
$('#field_title_dialog').modal('show');
} else {
create(type, $('#leave-name').val().trim());
create(type, $('#leave-name').val().trim(), $('#kwic').val());
}
});

$('#create').on('click', function() {
var name = $('#leave-name').val().trim(),
classlist = $(this)[0].classList,
highlight = $('#kwic').val(),
type = classlist[classlist.length - 1];
if (type == 'diagram') name = $('#name').val().trim();
if (type == 'interview') {
$("#transcript-leaf").prop("checked", true).trigger("click");
$('#field_title_dialog').modal('show');
} else {
create(type, name);
create(type, name, highlight);
}
});

$('#create_field-memo').on('click', function() {
var name = $('#location').val().trim() + ', ' + $('#date').val().trim(),
highlight = $('#kwic').val(),
type = $('input[name="type-of-field-memo"]:checked').val();
if (type != 'field') name = $('#pseudonym').val().trim() + ', ' + name;
if ([$('#location').val().trim(), $('#date').val().trim()].indexOf('') > -1) {
alert('{{i18n.i_enter_location_date}}');
} else {
create(type, name);
create(type, name, highlight);
}
});

Expand All @@ -582,7 +584,7 @@ <h1><img src="{{>relpath}}style/{{type}}.svg"/> {{name}}</h1>
$('#create-table').on('click', function() {
var classlist = $(this)[0].classList;
type = classlist[classlist.length - 1];
create(type, $('#leave-name').val().trim());
create(type, $('#leave-name').val().trim(), $('#kwic').val());
});

$('#link_leaf').on('click', function() {
Expand Down

0 comments on commit 948d2af

Please sign in to comment.