Skip to content

Commit ffac359

Browse files
committed
Finish usermanual update
1 parent b6ac48d commit ffac359

File tree

8 files changed

+96
-76
lines changed

8 files changed

+96
-76
lines changed

bin/spec_usermanual

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22

3-
RSPEC_PATTERN="spec/usermanual/usermanual_spec.rb"
3+
RSPEC_PATTERN="spec/usermanual/**/*.rb"
44
bundle exec rake spec SPEC_OPTS="--pattern $RSPEC_PATTERN --format documentation"

doc/usermanual/css/usermanual.css

+5-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ body p, li {
2323
max-width: 600px;
2424
}
2525

26-
body ul, p, h1, h2, h3, h4, h5, h6 {
26+
body ul, p, h1, h2, h3, h4, h5, h6, hr {
2727
max-width: 600px;
2828
margin-left: 30px;
2929
margin-right: 30px;
@@ -43,11 +43,12 @@ body > div {
4343
}
4444

4545
img.screenshot {
46-
border: 3px solid gray;
46+
border: 1px solid gray;
4747
display: block;
48-
max-width: 1000px;
49-
margin-left: auto;
48+
max-width: 800px;
49+
margin-left: 30px;
5050
margin-right: auto;
51+
margin-top: 1em;
5152
margin-bottom: 3em;
5253
}
5354

lib/doc_gen.rb

+6-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def render_template(template_path)
2727

2828
def screenshot(_options = {})
2929
name = next_screenshot_name
30-
screenshot_to_file("#{root_path}/screenshots/#{name}")
30+
screenshot_to_file("#{root_path}/screenshots/#{name}", _options)
3131
'<img src="screenshots/' + name + '" alt="(screenshot)" class="screenshot" />'
3232
end
3333

@@ -54,8 +54,11 @@ def next_screenshot_name
5454
"#{@doc_name}-#{@img_counter}.png"
5555
end
5656

57-
def screenshot_to_file(path)
57+
def screenshot_to_file(path, _options)
58+
default_options = { full: true }
59+
options = default_options.merge(_options)
5860
FileUtils.mkdir_p(File.dirname(path))
59-
@test_case.page.save_screenshot(path)
61+
options[:wide] ? @test_case.page.driver.browser.resize(1200, 800) : @test_case.page.driver.browser.resize(1024, 768)
62+
@test_case.page.save_screenshot(path, :full => options[:full])
6063
end
6164
end

lib/doc_gen/shell_session.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ExampleBlock
2929

3030
def initialize(session)
3131
@session = session
32-
@transcript = ''
32+
@transcript = ''.dup
3333
end
3434

3535
def blank_line

spec/spec_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# In console 1: Xvfb :99
3232
# In console 2: env DISPLAY=:99 rvmsudo rake spec
3333
Capybara.register_driver :poltergeist do |app|
34-
Capybara::Poltergeist::Driver.new(app, timeout: 60, js_errors: false, window_size: [1920, 1920])
34+
Capybara::Poltergeist::Driver.new(app, timeout: 60, js_errors: false)
3535
end
3636

3737
Capybara.default_driver = :poltergeist

spec/usermanual/admins.html.erb

+16-16
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ require 'cgi' # for escapeHTML
5555
<h2>Course templates</h2>
5656

5757
<p>
58-
Simplest way to create a course is to copy it from a template. This way teacher won't
59-
have to create new repositories from which new course will be based off. One of the biggest
60-
responsibilities for an administrator is managing these templates in TMC webapp.
58+
The simplest way to create a course is to copy it from a template. This way teachers won't
59+
have to create new exercise repositories for their courses. One of the biggest
60+
responsibilities for an administrator is managing course templates in the TMC webapp.
6161
</p>
6262

6363
<p>
@@ -72,7 +72,7 @@ require 'cgi' # for escapeHTML
7272
visit '/course_templates'
7373
highlight 'a:contains("New Course template")'
7474
%>
75-
<%= screenshot %>
75+
<%= screenshot(wide: true) %>
7676

7777
<p>
7878
This page lists all course templates in the database with their relevant information.
@@ -105,11 +105,11 @@ require 'cgi' # for escapeHTML
105105
<li><b>Title</b> is a prettier version of the name that may contain whitespaces, and is shown on webapp pages.</li>
106106
<li><b>Description</b> is a short piece of text to show when browsing this particular course.</li>
107107
<li>
108-
<b>Material url</b> takes user to the online resource that educates and helps the course participant with solving
108+
<b>Material url</b> takes the user to the online resource that educates and helps the course participant with solving
109109
the course exercises.
110110
</li>
111111
<li>
112-
<b>Source url</b> is a remote repository from which student will pull exercises as source files.
112+
<b>Source url</b> is a remote repository from which students will pull exercises as source files.
113113
When this field is edited, TMC webapp will validate the url by attempting to clone the repository from the url.
114114
You can find information on how to create a course repository by yourself from this <a href="customcourse.html#starting_from_a_template">guide</a>.
115115
</li>
@@ -118,7 +118,7 @@ require 'cgi' # for escapeHTML
118118
Default value is master.
119119
</li>
120120
<li>
121-
After the <b>Expires at</b> date no courses can be cloned from the expired template. Expiration date will not affect courses
121+
After the <b>Expires at</b> date, no courses can be cloned from the expired template. Expiration date will not affect courses
122122
that were cloned before the expiration date.
123123
</li>
124124
</ul>
@@ -142,7 +142,7 @@ require 'cgi' # for escapeHTML
142142
highlight 'a:contains("Edit"):first'
143143
highlight 'a:contains("unhide")'
144144
%>
145-
<%= screenshot %>
145+
<%= screenshot(wide: true) %>
146146

147147
<p>
148148
Whenever any changes to the remote repository are made (new exercises added, exercises removed, etc),
@@ -152,7 +152,7 @@ require 'cgi' # for escapeHTML
152152
</p>
153153

154154
<p>
155-
Course template default fields may be edited at any time by administrator via link 'Edit'. Expiration date
155+
Course template default fields may be edited at any time by administrator via the link 'Edit'. Expiration date
156156
may be changed through the same link.
157157
</p>
158158

@@ -168,12 +168,12 @@ require 'cgi' # for escapeHTML
168168
or disabled. Anyone can create a new organization, so they should be verified through careful consideration.
169169
</p>
170170

171-
<p>Administrator will see this notice on the front page when there are any unverified new organizations:</p>
171+
<p>Administrators will see this notice on the front page when there are any unverified new organizations:</p>
172172

173173
<%
174174
FactoryBot.create :user, login: 'user', password: 'user'
175175

176-
click_on 'Sign out'
176+
visit '/logout'
177177
visit '/login'
178178
fill_in 'username', with: 'user'
179179
fill_in 'password', with: 'user'
@@ -186,7 +186,7 @@ require 'cgi' # for escapeHTML
186186
click_button 'Create Organization'
187187
expect(page).to have_content 'Organization was successfully created.'
188188

189-
click_on 'Sign out'
189+
visit '/logout'
190190
visit '/login'
191191
fill_in 'username', with: 'admin'
192192
fill_in 'password', with: 'admin'
@@ -225,7 +225,7 @@ require 'cgi' # for escapeHTML
225225

226226
<%
227227
Organization.find_by(slug: 'hy').destroy!
228-
click_on 'Sign out'
228+
visit '/logout'
229229
visit '/login'
230230
fill_in 'username', with: 'user'
231231
fill_in 'password', with: 'user'
@@ -238,7 +238,7 @@ require 'cgi' # for escapeHTML
238238
click_button 'Create Organization'
239239
expect(page).to have_content 'Organization was successfully created.'
240240

241-
click_on 'Sign out'
241+
visit '/logout'
242242
visit '/login'
243243
fill_in 'username', with: 'admin'
244244
fill_in 'password', with: 'admin'
@@ -261,7 +261,7 @@ require 'cgi' # for escapeHTML
261261
%>
262262
<%= screenshot %>
263263

264-
<p>Disabled organization will not be shown anywhere in the front page.</p>
264+
<p>Disabled organizations will not be shown anywhere in the front page.</p>
265265

266266
<%
267267
visit '/'
@@ -271,7 +271,7 @@ require 'cgi' # for escapeHTML
271271
<h2>Monitoring background refreshes</h2>
272272

273273
<p>
274-
When a new course is made, first real-time refresh is made only partly, without generating available points for exercises. Because of that, full refresh is launched on background. As administrator, the front page shows if there are any ongoing background refreshes, and when they are made. Based on that, you can monitor possible problems, if certain course stays on the refresh list for too long time.
274+
When a new course is made, first real-time refresh is made only partly, without generating available points for exercises. Because of that, full refresh is launched on background. As administrator, the front page shows if there are any ongoing background refreshes, and when they were made. Based on that, you can monitor possible problems, if certain course stays on the refresh list for too long.
275275
</p>
276276

277277
<%

spec/usermanual/customcourse.html.erb

+23-9
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ require 'cgi' # for escapeHTML
3434

3535
<%
3636
teacher = FactoryBot.create(:admin, :login => 'teacher', :password => 'teacher')
37-
org = FactoryBot.create(:accepted_organization, name: 'Some organization')
37+
org = FactoryBot.create(:accepted_organization, name: 'Some organization', slug: 'someorg', information: 'A short description of this organization.')
3838
org.teachers << teacher
3939
org.save
4040
%>
@@ -56,11 +56,14 @@ require 'cgi' # for escapeHTML
5656
<p>Let's log in as a teacher of some organization.</p>
5757

5858
<%
59-
visit "/org/#{org.slug}"
60-
screenshot
6159
visit "/login"
6260
fill_in 'email', :with => 'teacher'
6361
fill_in 'password', :with => 'teacher'
62+
%>
63+
64+
<%= screenshot %>
65+
66+
<%
6467
click_on 'Sign in'
6568
visit "/org/#{org.slug}"
6669
%>
@@ -99,7 +102,7 @@ require 'cgi' # for escapeHTML
99102
repo_path = ENV['TMC_USERMANUAL_REPO_PATH'] || (ENV['HOME'] + '/tmc-example-repo')
100103
FileUtils.rm_rf(repo_path)
101104
FileUtils.mkdir_p(repo_path)
102-
create_bare_repo(repo_path, initial_commit: true)
105+
create_bare_repo(repo_path)
103106
repo_url = 'file://' + repo_path
104107

105108
fill_in 'course_source_url', :with => repo_url
@@ -126,6 +129,8 @@ require 'cgi' # for escapeHTML
126129

127130
click_button 'Continue'
128131
click_button 'Publish now'
132+
133+
RefreshCourseTask.new.run
129134
%>
130135

131136
<p>
@@ -288,19 +293,28 @@ require 'cgi' # for escapeHTML
288293
<% visit "/org/#{org.slug}/courses/#{course.id}/" %>
289294
<% highlight('a:contains("Refresh")') %>
290295
<%= screenshot %>
291-
<% click_on 'Refresh' %>
292-
<% course.reload %>
296+
<%
297+
click_on 'Refresh'
298+
299+
RefreshCourseTask.new.run
300+
301+
course.reload
302+
303+
course.exercises.update_all(disabled_status: 0)
304+
%>
293305

294306
<p>
295307
The system now reloads all exercises from the repository and rebuilds its
296308
internal caches. Any submissions made to previous exercises will survive this process,
297309
even if the exercise is deleted in the push.
298310
</p>
299311

312+
<% visit "/org/#{org.slug}/courses/#{course.id}/" %>
313+
300314
<%= screenshot %>
301315

302316
<p>
303-
The exercise should now be available for download and accept submissions.
317+
The exercises should now be available for download and they should accept submissions.
304318
</p>
305319

306320
<h2>Personalized course progression</h2>
@@ -387,9 +401,9 @@ deadline:
387401

388402
<h2>Special comments</h2>
389403

390-
<p>
404+
<b>
391405
See all available special comments <a href="https://github.com/rage/tmc-langs-rust/blob/master/docs/exercise%20template%20annotations.md">here</a>.
392-
</p>
406+
</b>
393407

394408
<p>
395409
Solution code can be demarcated with special comments so it will be removed from

0 commit comments

Comments
 (0)