-
Notifications
You must be signed in to change notification settings - Fork 33
Added export PDF functionality #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
3497727
5ce7e3b
c79fea0
80ca3be
d24a3fa
4868e68
8ccbac0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,4 +40,5 @@ data Action | |
| | ClosePackageModal | ||
| | ToggleEditor | ||
| | ToggleError | ||
| | ConvertToPDF | ||
| deriving (Read, Show) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,9 +40,12 @@ toolbar = rawHtml $ do | |
| li ! id "packageEditorButton" $ noHtml | ||
| li ! id "toggleEditorButton" $ noHtml | ||
| li ! id "toggleErrorButton" $ noHtml | ||
| li ! id "convertToPDFButton" $ noHtml | ||
| packageEditorModal -- Apparently, if we put this line | ||
| openProjectModal -- under this one. The open project modal doesn't work | ||
| modalPromptPlaceholder "newDirectoryModal" "New Directory" "Choose a name for the new directory" | ||
| convertToPDFModal | ||
| convertToPDFModalFail | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like you're rendering the modals inside of the toolbar. If there's no reason for that, I'd suggest to render them in the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I though there was the place where modals belong, maybe my mistake.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually it's a mistake by my part, instead of making a separate component for each modal I just jammed em all into the toolbar, which is awful, see #76 |
||
|
|
||
| openProjectModal :: Perch | ||
| openProjectModal = | ||
|
|
@@ -62,8 +65,20 @@ openProjectModal = | |
| div ! atr "class" "modal-footer" $ | ||
| div ! id "closeModalButton" $ noHtml | ||
|
|
||
| convertToPDFModal :: Perch | ||
| convertToPDFModal = | ||
| div ! id "convertToPDFModal" ! atr "class" "modal" $ do | ||
| div ! atr "class" "modal-content" $ do | ||
| h4 ("PDF saved on project path" :: String) | ||
|
|
||
| convertToPDFModalFail :: Perch | ||
| convertToPDFModalFail = | ||
| div ! id "convertToPDFModalFail" ! atr "class" "modal" $ do | ||
| div ! atr "class" "modal-content" $ do | ||
| h4 ("Error: wkhtmltopdf is not installed or a project has not been loaded" :: String) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not crucial, but Bootstrap allow for much richer modals with buttons ant that stuff to make users feel like they have some kind of control over their machines, I think that a BTW @NickSeagull, which version of Bootstrap are you using? Bootstrap 4 recently reached beta status, which obviously means that it's production-ready xDD
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're not using Bootstrap @javiertoledo , we're using Materialize 😄
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to look for other Materialize components but I didn't found a better one for the messages 😮 |
||
|
|
||
| modalPromptPlaceholder :: String -> String -> String -> Perch | ||
| modalPromptPlaceholder id' htitle text = | ||
| modalPromptPlaceholder id' htitle text = | ||
| div ! id id' ! atr "class" "modal" $ do | ||
| div ! atr "class" "modal-content" $ do | ||
| if (not . null) htitle then h4 htitle else noHtml | ||
|
|
@@ -125,6 +140,11 @@ toggleErrorButton _ = Ulmus.newWidget "toggleErrorButton" $ wlink ToggleError $ | |
| a ! atr "class" "btn-floating purple darken-2 tooltipped" ! atr "data-position" "bottom" ! atr "data-tooltip" "Toggle error" ! atr "data-delay" "50"$ | ||
| i ! atr "class" "material-icons" $ ("error" :: String) | ||
|
|
||
| convertToPDFButton :: State -> Widget Action | ||
| convertToPDFButton _ = Ulmus.newWidget "convertToPDFButton" $ wlink ConvertToPDF $ | ||
| a ! atr "class" "btn-floating purple darken-2 tooltipped" ! atr "data-position" "bottom" ! atr "data-tooltip" "Convert to PDF" ! atr "data-delay" "50"$ | ||
| i ! atr "class" "material-icons" $ ("picture_as_pdf" :: String) | ||
|
|
||
|
|
||
| closeModalButton :: State -> Widget Action | ||
| closeModalButton _ = Ulmus.newWidget "closeModalButton" $ wlink LoadProject $ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you're checking the existence of the
wkhtmltopdfbinary twice here. I'd usewhich, that not only tells you if the file exists or not, but also what's its location. I guess there will be people out there that have installedwkhtmltopdfsomewhere else, so for them, I think that this code will fail when it tries to find the binary in/usr/binUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @javiertoledo! Thats true, I think that would be enough with the which command, my mistake 👍