diff --git a/src/core/routes/Routes.py b/src/core/routes/Routes.py index 03ff493..7eb6589 100644 --- a/src/core/routes/Routes.py +++ b/src/core/routes/Routes.py @@ -68,10 +68,10 @@ def listFiles(_hash = None): path = view.get_path_part_from_hash(_hash) view.push_to_path(path) - path = view.get_current_directory() - files = view.get_files_formatted() - fave = db.session.query(Favorites).filter_by(link = path).first() - in_fave = "true" if fave else "false" + sub_path = view.get_current_sub_path() + files = view.get_files_formatted() + fave = db.session.query(Favorites).filter_by(link = sub_path).first() + in_fave = "true" if fave else "false" files.update({'in_fave': in_fave}) return files else: @@ -129,7 +129,6 @@ def loadFavorite(_id): ID = int(_id) fave = db.session.query(Favorites).filter_by(id = ID).first() view = get_window_controller().get_window(1).get_view(0) - print(fave.link) view.set_path_with_sub_path(fave.link) return '{"refresh": "true"}' except Exception as e: @@ -144,16 +143,16 @@ def loadFavorite(_id): @app.route('/api/manage-favorites/<_action>', methods=['GET', 'POST']) def manageFavorites(_action): if request.method == 'POST': - ACTION = _action.strip() - view = get_window_controller().get_window(1).get_view(0) - path = view.get_current_directory() + ACTION = _action.strip() + view = get_window_controller().get_window(1).get_view(0) + sub_path = view.get_current_sub_path() if ACTION == "add": - fave = Favorites(link=path) + fave = Favorites(link = sub_path) db.session.add(fave) msg = "Added to Favorites successfully..." else: - fave = db.session.query(Favorites).filter_by(link = path).first() + fave = db.session.query(Favorites).filter_by(link = sub_path).first() db.session.delete(fave) msg = "Deleted from Favorites successfully..." diff --git a/src/core/static/css/main.css b/src/core/static/css/main.css index 9ab0ce6..edb9d36 100644 --- a/src/core/static/css/main.css +++ b/src/core/static/css/main.css @@ -51,7 +51,7 @@ } .viewer { - max-width: 45em; + max-width: 60em; } diff --git a/src/core/static/js/post-ajax.js b/src/core/static/js/post-ajax.js index 7f16887..a3c1cef 100644 --- a/src/core/static/js/post-ajax.js +++ b/src/core/static/js/post-ajax.js @@ -21,6 +21,7 @@ const postAjaxController = (data, action) => { const updateHTMLDirList = async (data) => { let images = data.list.images[0]; let isInFaves = data.in_fave; + console.log(isInFaves); let background_image = (images[0]) ? images[0][0] : ""; diff --git a/src/core/static/js/react-ui-logic.js b/src/core/static/js/react-ui-logic.js index 905cf43..c91c5ef 100644 --- a/src/core/static/js/react-ui-logic.js +++ b/src/core/static/js/react-ui-logic.js @@ -74,7 +74,7 @@ class FilesList extends React.Component { } final.push( -