Skip to content

Commit e010c3d

Browse files
setup baseline rendering of attribution details, with rough functions to build out
1 parent 7a8d2a7 commit e010c3d

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

src/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ <h2>Mark Your Work</h2>
347347
<p>Choose the kind of work to get appropriate license code or public domain marking.</p>
348348
</header>
349349

350-
<h3>Website</h3>
350+
<!-- <h3>Website</h3>
351351
<p>If you are licensing or marking one work, paste the code next to it. If you are licensing or marking the whole page or blog, you can paste the code at the bottom of the page.</p>
352352
353353
<h4>Rich Text</h4>
@@ -357,13 +357,13 @@ <h4>HTML</h4>
357357
<p>[contextually formatted mark here]</p>
358358
359359
<h4>XMP</h4>
360-
<p>[contextually formatted mark here]</p>
360+
<p>[contextually formatted mark here]</p> -->
361361

362362
<h3>Print Work or Media</h3>
363363
<p>Copy the text below and paste it on the title and/or copyright page of your print work or presentation, or in the credits of your media.</p>
364364

365365
<h4>Plain Text</h4>
366-
<p>[contextually formatted mark here]</p>
366+
<p class="mark-holder">[contextually formatted mark here]</p>
367367

368368
<footer>
369369
<p>[toggle: (license abbreviation) | (full license name)]</p>

src/scripts.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ function setStateProps(index, state) {
144144
console.log('cursor at:');
145145
console.log(index);
146146

147+
state.props.attribution = [];
148+
state.props.attribution.title = document.querySelector('#attribution-details #title').value;
149+
state.props.attribution.creator = document.querySelector('#attribution-details #creator').value;
150+
state.props.attribution.workLink = document.querySelector('#attribution-details #work-link').value;
151+
state.props.attribution.creatorLink = document.querySelector('#attribution-details #creator-link').value;
152+
state.props.attribution.workCreationYear = document.querySelector('#attribution-details #work-creation-year').value;
153+
147154
}
148155

149156
// function to reset values beyond current fieldset
@@ -199,6 +206,31 @@ function renderLicenseRec(state) {
199206
}
200207
}
201208

209+
// function to render "mark your work",
210+
// if valid license from state.parts and/or state.current
211+
// if attribution details input(s) filled out
212+
function renderMarkYourWork(state) {
213+
if (state.props.license != 'unknown' ) {
214+
// load attribution details template,
215+
// populate from attribution text values
216+
document.querySelector('#mark-your-work').classList.remove('disable');
217+
218+
//state.props.attribution.title
219+
let title = state.props.attribution.title;
220+
let workCreationYear = state.props.attribution.workCreationYear;
221+
222+
let phrase = '(c) ' + workCreationYear + ' ' + title + ' is licensed under ';
223+
224+
document.querySelector('#mark-your-work .mark-holder').textContent = phrase + state.props.license;
225+
226+
}
227+
228+
else if (state.props.license == 'unknown') {
229+
// set to empty
230+
}
231+
232+
}
233+
202234
// function to set default UX states on Steps
203235
// set default visibly disabled pathways
204236

@@ -215,6 +247,7 @@ function setDefaults(applyDefaults) {
215247
}
216248

217249
document.querySelector('#license-recommendation').classList.add('disable');
250+
document.querySelector('#mark-your-work').classList.add('disable');
218251
}
219252

220253
// stepper logic here for what parts of form are
@@ -316,6 +349,8 @@ function watchFieldsets(fieldsets, state) {
316349
renderSteps(applyDefaults, state);
317350

318351
renderLicenseRec(state);
352+
353+
renderMarkYourWork(state);
319354
});
320355

321356
});

0 commit comments

Comments
 (0)